I have elastic search documents with a structure like this:
{ "name": "item1", "storages": [ {"items": ["a", "b", "c", "d", "e", "f"]}, {"items": ["a 1", "b 2", "c 3", "d 4", "e 5", "f 6"]}] } { "name": "item2", "storages": [ {"items": ["d", "e", "f", "g", "h", "i", "j"]}, {"items": ["d 4", "e 5", "f 6", "g 7", "h 8", "i 9", "j 10"]} ] }
and I want to find a sequence of lines, for example ["d 4", "e 5"]. For this, I use the MoreLikeThis query:
{ "query": { "more_like_this" : { "fields" : ["storages.items"], "like" : ["d 4","e 5"], "min_term_freq": 1, "min_doc_freq": 1 } } }
and it works almost perfectly, but returns "_score": 0.1620518 for the first document and "_score": 0.13890153 for the second.
I want to increase points for terms from the beginning of the array ("elements"), since "d 4", "e 5" appears at the beginning of the array, it should be ranked higher.
Is there a way to create such a query in elasticsearch? Maybe this should not be more like this request?
The hard part is that the request may be something like ["d 4", "e 5", "xxx"] (xxx is missing from the document, but this is normal)