Hello Everyone,
I'm working on upgrading the query from ES 2.X to 5.6. But i'm having problem with inner hits inside the function, see my query below.
Mappings:
PUT test { "mappings": { "doc": { "properties": { "comments": { "type": "nested", "properties": { "text": { "type": "text", "store": true } } } } } } }
Data:
PUT test/doc/1?refresh { "title": "Test title", "comments": [ { "author": "kimchy", "text": "comment text" }, { "author": "nik9000", "text": "words words words" } ] }
Query/DSL:
POST test/_search { "query": { "function_score": { "query": { "function_score": { "query": { "bool": { "should":[ { "query_string": { "boost": 1.0, "query": "Test", "default_operator": "and", "fields": [ "title" ] } } ], "filter": { "terms": { "_id": [ "1" ] } } } }, "functions": [ { "filter": { "bool": { "must":[ { "nested":{ "path": "comments", "score_mode": "max", "query":{ "bool": { "must":[ { "query_string": { "query": "Kim", "default_field": "comments.author", "default_operator": "and" } } ] } }, "inner_hits": { "name": "sdInnerHits1", "size": 100 } } } ] } }, "weight": 1.0 } ], "score_mode": "max", "boost_mode": "sum" } }, "functions": [ ], "score_mode": "sum", "boost_mode": "sum" } } }
Basically, what i'm trying to accomplish here is to get the inner hits named "sdInnerhits1".
Thank you!
-Kenneth