Given that I have following document in an index:
PUT /test_index/my_type/1
{
"id": 1,
"my_array": ["1", "2", "3", "4"]
}
If I run the following query on ES 1.x, it gives me 0 total hits, as expected:
POST /test_index/my_type/_search
{
"query": {
"function_score": {
"score_mode": "sum",
"filter": {
"bool": {
"must": {
"terms": {
"my_array": ["1", "5"],
"execution": "and"
}
}
}
}
}
},
"size": 50,
"from": 0
}
But on ES 2.x, as the execution does not work with terms anymore, what would be the best aproach to rewrite this query? Is there a better option than the following one?
POST /test_index/my_type/_search
{
"query": {
"function_score": {
"score_mode": "sum",
"filter": {
"bool": {
"must": [{
"terms": {
"my_array": ["1"]
}
},
{
"terms": {
"my_array": ["5"]
}
}]
}
}
}
},
"size": 50,
"from": 0
}
Best Regards,
Luis