我对 Elasticsearch Term Facet 有疑问
我把数据如下:
curl -X DELETE "http://localhost:9200/articles'
curl -X POST "http://localhost:9200/articles/article" -d '{"title" : "One", "tags" : "foo","datetime":"2005-12-23 23:10:52"}'
curl -X POST "http://localhost:9200/articles/article" -d '{"title" : "Two", "tags" : "bar","datetime":"2005-12-23 23:10:53"}'
curl -X POST "http://localhost:9200/articles/article" -d '{"title" : "Three", "tags" : "baz","datetime":"2005-12-23 23:10:54"}'
curl -X POST "http://localhost:9200/articles/article" -d '{"title" : "four", "tags" : "baz","datetime":"2005-12-23 23:10:55"}'
curl -X POST "http://localhost:9200/articles/article" -d '{"title" : "five", "tags" : "foo","datetime":"2005-12-23 23:10:56"}'
因此,每当我查询术语方面时,它都会给出正确的结果,以下是我的 Elasticsearch 查询:
curl 'http://localhost:9200/articles/article/_search?pretty=true' -d '{
"query": {
"match_all": {}
},
"facets" : { "myfacet" : { "terms" : {"field" : "tags"}}
}
}'
但是,当我向 Facet 添加过滤器时,它不会显示任何方面计数以下是查询:
curl 'http://localhost:9200/articles/article/_search?pretty=true' -d '{
"query": {
"match_all": {}
},
"facets" : {
"myfacet" : { "terms" : {"field" : "tags"},
"filter" : { "range" :{
"datetime" : {"from" : "2005-12-23 3:10:52","to" : "2005-12-23 23:10:56" }
}
}
}
}
}'
我得到如下结果
facets" : {
"myfacet" : {
"_type" : "filter",
"count" : 0
}
}
所以,任何人都知道为什么它给出这样的计数。