Is it possible to relate fields in an index in ElasticSearch such that highlights are matched across fields?

Viewed 24

I have an index which is constructed in the following way:

{'id': 'xxx-xxx',
   'text': 'ALICE was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do',
   'start': '0:00:01.94 0:00:02.30 0:00:02.62 0:00:02.96 0:00:03.14 0:00:03.30 0:00:03.42 0:00:03.58 0:00:03.84 0:00:03.92 0:00:04.06 0:00:05.64 0:00:05.94 0:00:06.34 0:00:06.72 0:00:07.90 0:00:08.28 0:00:09.06 0:00:09.20 0:00:09.32 0:00:09.40'
}

When searching for 'very tired' I would like to return

  • text: 'very tired'
  • start: '0:00:03.30 0:00:03.42'

Is there anyway that I can formulate a query that allows me to do this? Or a way to index the data that allows me to return the text that is matched and the corresponding times?

1 Answers

as you have it, Elasticsearch treats each of the blocks as their own fully searchable terms

you'd need to break it down to directly associate each text work with it's start time to be able to do that

Related