以下是
的示例回复 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
是一个数组? 答案 0 :(得分:3)
hits.hits
是一系列符合您搜索查询的已找到文档_source
对象"size" : 0
子句,然后hits.hits
数组将为空