【发布时间】:2015-07-15 11:15:52
【问题描述】:
这是我用于获取 id
的弹性搜索查询curl -XGET localhost:9200/test-index2/business/_search -d'
{
"query" : {
"filtered" : {
"query" : {
"match_all" : {}
},
"filter" : {
"term" : {
"_id" : "AU6LqK0WCSY7HKQGengx"
}
}
}
}
}'
这是响应的一部分
{"contactNumber": "+1-415-392-3702", "name": "Golden Gate Hotel"}
我有 contactNumber 和 name
现在我的第二个查询 -> 我正在使用术语过滤器查询上述联系电话
curl -XGET localhost:9200/test-index2/business/_search -d'
{
"query" : {
"filtered" : {
"query" : {
"match_all" : {}
},
"filter" : {
"term" : {
"contactNumber" : "+1-415-392-3702"
}
}
}
}
}'
我有 0 次点击!
我已经索引了contactNumber 和name 字段。
我做错了什么??
我应该得到完全相同的记录
编辑:
附上联系电话的映射
{"test-index2":{"mappings":{"business":{"properties":{"address":{"type":"string"},"contactNumber":{"type":"string","store":true},"name":{"type":"string"}}}}}}
【问题讨论】:
-
contactNumber的映射是什么? -
@AndreiStefan 编辑添加联系人号码的映射
-
contactNumber应该有一个不会改变其内容的analyzer,例如keyword或者应该是not_analyzed。
标签: json elasticsearch