This is how the response looks like:
{
"hits" : {
"hits" : [
{
"_index" : "myindex",
"_type" : "_doc",
"_id" : "7201e7f0-882f-4184-bdda-71302b8c28d3",
"_source" : {...},
"inner_hits" : {
"inner_hits_1" : {
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"hits" : [
{
"_index" : "myindex",
"_type" : "_doc",
"_id" : "7201e7f0-882f-4184-bdda-71302b8c28d3",
"_nested" : {
"field" : "transcript",
"offset" : 1
},
"_source" : {
"phrase" : "good afternoon"
"conv_id" : 1
},
"highlight" : {
"transcript.phrase" : [
"<HIGHLIGHT>good<HIGHLIGHT/> afternoon"
]
}
}
]
}
},
"inner_hits_2" : {...},
"inner_hits_3" : {...}
}
}
]
}
}
How do I loop over all the inner_hits
within post_filter
via script ?
Something like this:
GET myindex/_search
{
"query": {...},
"post_filter": {
"script": {
"script": {
"lang": "painless",
"source": """
// loop over inner_hits here and filter documents
"""
}
}
}
}