类型映射
{
"pois-en": {
"mappings": {
"poi": {
"properties": {
"address": {
"type": "string",
"analyzer": "portuguese"
},
"city": {
"type": "integer"
},
(...)
"type": {
"type": "integer"
}
}
}
}
}
}
全部查询:
GET pois-en/_search
{
"query":{
"match_all":{}
},
"fields": ["city"]
}
返回:
"hits": [
{
"_index": "pois-en",
"_type": "pois_poi",
"_id": "491",
"_score": 1,
"fields": {
"city": [
91
]
}
},
(...)
但是当我使用以下过滤器过滤时:
GET pois-en/_search
{
"query" : {
"filtered" : {
"query" : {
"match_all" : {}
},
"filter" : {
"term" : {
"city" : 91
}
}
}
}
}
它一无所获!
我无法弄清楚我做错了什么。对于 Django 和 Elasticsearch 通信,我是 Elasticutils ( https://github.com/mozilla/elasticutils ),但我现在使用 Sense 来进行这些查询。
提前致谢