저는 신축성있는 검색을 배우고 있으며 고유 한 값을 계산하려고합니다. 지금까지는 가치를 셀 수 있지만 별개의 것은 아닙니다.elasticsearch를 사용하여 고유 한 값 계산
curl http://localhost:9200/store/item/ -XPOST -d '{
"RestaurantId": 2,
"RestaurantName": "Restaurant Brian",
"DateTime": "2013-08-16T15:13:47.4833748+01:00"
}'
curl http://localhost:9200/store/item/ -XPOST -d '{
"RestaurantId": 1,
"RestaurantName": "Restaurant Cecil",
"DateTime": "2013-08-16T15:13:47.4833748+01:00"
}'
curl http://localhost:9200/store/item/ -XPOST -d '{
"RestaurantId": 1,
"RestaurantName": "Restaurant Cecil",
"DateTime": "2013-08-16T15:13:47.4833748+01:00"
}'
그리고 내가 지금까지 시도 :
이curl -XPOST "http://localhost:9200/store/item/_search" -d '{
"size": 0,
"aggs": {
"item": {
"terms": {
"field": "RestaurantName"
}
}
}
}'
는 출력 :
{
"took": 0,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 3,
"max_score": 0.0,
"hits": []
},
"aggregations": {
"item": {
"buckets": [
{
"key": "restaurant",
"doc_count": 3
},
{
"key": "cecil",
"doc_count": 2
},
{
"key": "brian",
"doc_count": 1
}
]
}
}
}
가 어떻게 cecil
대신 1 등의 수를 얻을 수 있습니다 여기에
curl -XPOST "http : // localhost : 9200/store/item/_search"-d '{ "size": 0, "aggs": { "item": { "카디널리티" "field": "RestaurantName"}}}} '그러나 뚜렷한 카운트를 얻지 못함 – Developer
curl -XGET이어야합니까? – c24b
그리고 항목으로 집계 이름을 바꾸어도 괜찮습니까? – c24b