My query below is returning an incorrect result. You can see that the "params" in the result do not perfectly match the terms params in the query. How do I craft my query so that the params must match perfectly?
The query:
GET _search
{
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"term": {
"class": "ezr_ribbon_army"
}
},
{
"term": {
"award_sku": "401 ARACMR"
}
},
{
"terms": {
"params": [
"bronze-star|1",
"branch|army",
"type|standard_ribbons",
"spacing|flush",
"alignment|center",
"assembly|assembled",
"width|3"
]
}
},
{
"term": {
"params_count": 7
}
}
]
}
}
}
}
}
The results:
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "awards.v1",
"_type": "awards",
"_id": "AU5pVpCi-IpoJe5I_BhB",
"_score": 1,
"_source": {
"images": [
"120445907559bfe269242d0.48849945.png"
],
"award_sku": "401 ARACMR",
"class": "ezr_ribbon_army",
"params": [
"bronze-star|1",
"silver-star|2",
"spacing|flush",
"alignment|center",
"assembly|assembled",
"branch|army",
"type|standard_ribbons"
],
"device_skus": [
"937NP",
"914NP"
],
"params_count": 7
}
}
]
}
}
The mapping:
{
"awards.v1": {
"mappings": {
"awards": {
"_all": {
"enabled": false
},
"properties": {
"award_sku": {
"type": "string",
"index": "not_analyzed"
},
"class": {
"type": "string",
"index": "not_analyzed"
},
"device_skus": {
"type": "string",
"index": "not_analyzed"
},
"images": {
"type": "string",
"index": "not_analyzed"
},
"params": {
"type": "string",
"index": "not_analyzed"
},
"params_count": {
"type": "integer"
},
"skus": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
}