Hi everyone,
I hope someone can guide me with some guides or links on this please .
I have an index with two fields of interest : adapterid and country and I am trying to write a query without going thorugh every permutation.
adapterid : is a text field and the string consists of a countrycode followed by a string of text ie "ukoffnetwork" or "ukonnetwork" or "aeoffnetwork" .. there is one for every single country which is about 100+
and in the same document there is a
country field : ie "uk" , "ae" , "de" "us" etc
Now I want to create a search that will return every document that adapterid does not match the country code .
GET /testindex-f-audit/_search
{
"query": {
"bool": {
"must": [],
"filter": [
{
"match_all": {}
},
{
"match_phrase": {
"adapterid": "AEOffNetwork"
}
}
],
"should": [],
"must_not": [
{
"match_phrase": {
"country": "AE"
}
}
]
}
}
}
but i dont want to write a query for every single country
Is there a way to write a query where i can return all documents where the first 2 characters (subset) of one field does not match the contents of another field in the same document?
I am using aws elasticsearch so i am on 7.7 and i have looked at the wildcard keyword but i think that is a 7.10 but hasn't anyone anything similar to this in the past .
Any help would be grately appreciated.
Cheers
yoyomonkey