我有以下的JSON数据:
[
{"firstname": "john", "lastname": "doe"},
{"firstname": "john", "lastname": "smith"},
{"firstname": "jane", "lastname": "smith"},
{"firstname": "jane", "lastname": "doe"},
{"firstname": "joe", "lastname": "smith"},
{"firstname": "joe", "lastname": "doe"},
{"firstname": "steve", "lastname": "smith"},
{"firstname": "jack", "lastname": "doe"}
]
我想获取重复名字的数量
重复的数量为3
非重复名字的数量统计
非重复的数量为2
我试图计算桶的数量,但似乎无论是重复还是非重复的都被计算了
GET mynames/_search
{
"aggs" : {
"name_count" : {
"terms" : {
"field" : "firstname.keyword",
"min_doc_count": 2
}
},
"count":{
"cardinality": {
"field": "firstname.keyword"
}
}
}
first name : "John"
),而是整个句子/段落进行操作?例如:description : "Hello world!"
- K-tan