Facets 为您提供特定字段的特定单词存在的文档数量...
现在假设您有一个名为 tweets 的索引,类型为 tweets 和字段“name”...
字段“名称”的方面查询将是:
curl -XPOST "http://localhost:9200/tweets/tweet/_search?search_type=count" -d'
{
"facets": {
"name": {
"terms": {
"field": "name"
}
}
}
}'
现在您得到的响应如下
"hits": {
"total": 3475368,
"max_score": 0,
"hits": []
},
"facets": {
"name": {
"_type": "terms",
"total": 3539206,
"other": 3460406,
"terms": [
{
"term": "brickeyee",
"count": 9205
},
{
"term": "ken_adrian",
"count": 9160
},
{
"term": "rhizo_1",
"count": 9143
},
{
"term": "purpleinopp",
"count": 8747
}
....
....
这被称为术语方面,因为这是基于术语的计数......还有其他方面也可以在这里看到