I am trying to add a sophisticated lookup filter using elastic search. The filter seems to work, however the results do not take into account the wildcard. Is this possible or is there an alternative to the substitution filter? The request is as follows:
{
"query": {
"filtered": {
"query": {
"wildcard": {
"name": "*frog*"
},
"filter": {
"bool": {
"must": {
"term": {
"is_animal": false
}
}
},
"or": [
{
"terms": {
"reptiles.codes": [
27
]
}
},
{
"nested": {
"path": "owners",
"query": {
"bool": {
"should": {
"term": {
"pets": "cat"
}
}
}
}
}
},
{
"nested": {
"path": "locations",
"query": {
"bool": {
"should": {
"term": {
"home": true
}
}
}
}
}
}
]
}
}
}
}
}
Alternatively, you can add a wildcard as a filter inside my "bool": {"must": ....}}?
source
share