I am trying to search a index in elastic search with the following body:
{
"query": {
"bool": {
"must": [
{
"query_string": {
"query": "a*",
"default_operator": "AND"
},
{
"match": {
"country": "Spain"
}
},
{
"match": {
"city": "Madrid"
}
}
]
}
}
}
here is my indexed results:
[
{
_id: "T__cU34BAF3zuzOUa7rD"
_index: "es"
_score: 1
_source: {
name: "Santiago",
country: "Spain",
city: "Madrid",
}
_type: "_doc"
},
...
]
So this supposed to search for a word found in field city inside the country.
country and city are optional by the way and it should return all queries that start with a if city and country are empty.