Here is my settings file -
{
"settings": {
"mappings": {
"default": {
"properties": {
"AIRPORT_CODE": {
"type": "text"
},
"PROVINCE_NAME": {
"type": "text"
},
"AIRPORT_NAME": {
"type": "text"
},
"CITY_NAME": {
"type": "text"
},
"TYPE": {
"type": "keyword"
},
"COUNTRY_NAME": {
"type": "text"
}
}
}
}
}
}
Here are my sample documents
{
"AIRPORT_CODE": "SQA",
"PROVINCE_NAME": "California",
"AIRPORT_NAME": "Santa Ynez Airport",
"CITY_NAME": "SANTA YNEZ",
"TYPE": "AIRPORT"
}
{
"PROVINCE_NAME": "SANTIAGO",
"CITY_NAME": "SANTIAGO",
"COUNTRY_NAME": "DOMINICAN REPUBLIC",
"TYPE": "HOTEL"
}
Here is my search -
{
"size": 4,
"timeout": "2m",
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "SQA"
}
}
],
"filter": [
{
"term": {
"TYPE": "AIRPORT"
}
}
]
}
},
"explain": false
}
The "TYPE" field has been defined as keyword. But the above query doesn't return anything. If change the "TYPE" value from "AIRPORT" to "airport" (lowercase), I get the results back. What am I doing wrong?
Note # My effort is to get this query working so I can take the advantage of filter cache (node query cache).
Thanks in advance!