I have a list of values and I want all documents that have any of these values in their product_code field.
I tried this, but even though it doesn't give an error, it only gives me one of the documents:
"query": {
"match": {
"product_code": {
"query": ["ABC 4", "ABC 5"]
}
}
}
So I'm basically looking for the functionality of the terms filter, but with analysis.
Of course I could do:
"bool": {
"should": [
{
"query": {
"match": {
"product_code": "ABC 4"
}
}
},
{
"query": {
"match": {
"product_code": "ABC 5"
}
}
}
]
}
but this gets rather verbose for long lists.
product_code is defined like this:
"product_code": {
"type": "string",
"analyzer": "product_code",
}
with the product_code analyzer:
"product_code": {
"type": "custom",
"filter": [
"lowercase",
"trim"
],
"tokenizer": "keyword"
}