I have following mapping:
{
cities: {
mappings: {
city: {
properties: {
id: {
type: "long"
},
name: {
type: "text",
fields: {
keyword: {
type: "keyword",
ignore_above: 256
}
}
},
population: {
type: "long"
},
}
}
}
}
}
and performing simple query:
{
query: {
bool: {
must_not: { match: { name: 'New York' } },
},
},
size: 2,
}
So in the results I get:
{
"took": 5,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 10385,
"max_score": 1,
"hits": [
{
"_index": "cities",
"_type": "city",
"_id": "14",
"_score": 1,
"_source": {
"name": "Berlin",
"id": 14,
"population": 7293
}
},
{
"_index": "cities",
"_type": "city",
"_id": "19",
"_score": 1,
"_source": {
"name": "Paris",
"id": 19,
"population": 25018
}
}
]
}
}
How can I limit this query to match documents where name is in specific array of values, i.e. ['Berlin', 'Bonn', 'Munchen'] ?
I'm looking for something simmilar to SQL statement like:
SELECT * FROM cities WHERE name != 'New York' and name IN ('Berlin', 'Bonn', 'Munchen');