Position of matched elment of a nested Data structure in Native Plugin


(Saiteja Veera) #1

I'm building native plugin to score the documents. Have a data structure like the following to be indexed:

[
{
'content': 'abcd efgh',
'score': 23
},
{
'content': 'ijlk mnop',
'score': 35
}
]

Similar data structure should be indexed for each document. 'content' will go through a custom analyzer and number of elements in the above array can be as big as 25 and score is something which is dynamic and is available at the index time.

For a given query if a document matches, then depending on where it is present in the above array corresponding score will be used for scoring.

Nested datatype doesn't work because it converts into bag of words. Flattening by each field like content as an array and score as an array also didn't work because order is not retained. Cannot afford to use store fields or _source because of performance bottlenecks.

Any suggestions on how I can approach this?


(Ryan Ernst) #2

It seems like you want the position of the term? That should be straightforward to grab, but you will need to pass the term which was queried on into the script, so that you can grab the term info and advance it for each doc the script is run on.


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.