【发布时间】:2014-07-22 16:16:03
【问题描述】:
以下是
的示例响应curl -X POST "http://localhost:9200/articles/_search?pretty=true" -d '
{
"facets": {
"speaker" : { "terms" : {"field" : "speaker"} }
}
}'
示例响应
{
"took": 16,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 111396,
"max_score": 1,
"hits": [
{
"_index": "shakespeare",
"_type": "line",
"_id": "63098",
"_score": 1,
"_source": {
"line_id": 63099,
"play_name": "Merchant of Venice",
"speech_number": 5,
"line_number": "3.3.14",
"speaker": "SHYLOCK",
"text_entry": "Ill have my bond; and therefore speak no more."
}
},
{
"_index": "shakespeare",
"_type": "line",
"_id": "63101",
"_score": 1,
"_source": {
"line_id": 63102,
"play_name": "Merchant of Venice",
"speech_number": 5,
"line_number": "3.3.17",
"speaker": "SHYLOCK",
"text_entry": "To Christian intercessors. Follow not;"
}
}
]
},
"facets": {
"speaker": {
"_type": "terms",
"missing": 0,
"total": 111396,
"other": 100157,
"terms": [
{
"term": "GLOUCESTER",
"count": 1920
},
{
"term": "HAMLET",
"count": 1582
}
]
}
}
}
有人能解释一下这部分反应吗?
- 为什么
hits.hits是一个数组? - 每个 hits 对象是什么意思?
- 有没有办法抑制弹性搜索响应的命中?
【问题讨论】:
-
为什么投反对票?注意:构面被聚合取代:
facets have been replaced by aggregations in Elasticsearch 1.0, which are a superset of facets.我想要没有命中结果的聚合结果,我认为这就是文卡特问题的精神。即使 Elasticsearch 以任何一种方式执行相同的工作,空的 hits 数组也会使响应变小。 -
@TheRedPea 你说得对。
标签: elasticsearch