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?