【发布时间】:2017-07-10 14:40:31
【问题描述】:
我有以下映射:
{
"events": {
"mappings": {
"event": {
"Type of Event": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
以及索引里面的如下数据
{
"Type of Event": "Orientation Session"
},
{
"Type of Event": "Orientation Tutorial"
}
我正在尝试仅匹配具有Type of Event == "Orientation Session" 的那些。
我正在尝试以下查询:
{
"query": {
"term": {
"Type of Event.keyword": "Orientation Session"
}
}
}
但它不匹配任何东西。但是,如果字符串中没有空格,它确实有效。我不能在这里使用match 查询,因为它会匹配这两个事件。
我做错了什么?我在术语查询中看到了很多关于空格的讨论,但没有关于使用keyword 的讨论。它们都特定于 elasticsearch 2.0。
【问题讨论】:
标签: elasticsearch