I have the following mapping:
{
"events": {
"mappings": {
"event": {
"Type of Event": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
And the following data inside the index
{
"Type of Event": "Orientation Session"
},
{
"Type of Event": "Orientation Tutorial"
}
I am trying to match only those with Type of Event == "Orientation Session"
.
I'm trying the following query:
{
"query": {
"term": {
"Type of Event.keyword": "Orientation Session"
}
}
}
but it doesn't match anything. It does, however, work if there are no spaces in the string. I can't use match
query here, as it would match both events.
What am I doing wrong? I've seen a lot of discussion on spaces in term queries, but none about using keyword
. They all are specific to elasticsearch 2.0.