Hi,
I have a use-case where I have some metadata information about certain terms present in the document, that I want to separately store in a field. I also want any matches to terms with the metadata specific information, highlight only those occurrences of the terms which have the metadata.
Example (simplistic one to illustrate a parallel usecase):
I eat a lot of chocolates. Eat is a great restaurant.
Snippet:
{
{"verb":"eat"}
{"noun":"Eat"}
{"content": "I eat a lot of chocolates. Eat is a great restaurant."
}
I would like to store information about this statement with mapping such as "field:Noun, field:Verb" etc. and parse the about document and add "eat" to both the Noun and Verb fields. Along with it, I want to store the information about the position of "eat" in both the fields to be the right occurrence of eat in the original document - i.e., position "2" for verb and position "7" for noun, that I would like to use later when I highlight uses of eat as a Noun to the user in my UX. (Basically a query of verb:eat should retrieve the above document and only highlight the occurrence of "eat" in the first sentence.
What options do I have to do this?
- Ideally, if I can change the positional information being stored inside the specific fields of ES, I could override it to give position "2" for verb field (instead of the default position"1" it would pick). Is there any support for this to be extensible inside ES today?
- Store it as term payload along with each term. I would like to avoid this if possible.
Other options?
Thanks
Mahathi