doc_values对terms aggregation不起作用,对cardinality起作用,什么原因?
Elasticsearch | 作者 爱你一点点 | 发布于2016年04月25日 | 阅读数:5386
1、es2.3.1,所有字段不分词,且启用doc values
{
"settings" : {
"index" : {
"number_of_shards" : 20,
"number_of_replicas" : 1
}
},
"mappings":
{
"_default_":
{
"dynamic_templates": [
{
"stringNotAnalyze": {
"mapping": {
"type": "string",
"doc_values":true,
"index":"not_analyzed",
"store":false
},
"match_mapping_type": "string"
}
}
]
}
}
}
2、
terms :
{
"aggs": {
"计数": {
"terms": {
"field": "username"
}
}
}
}
3、agg统计后,kopf下看到fielddata大小
"fielddata": { "memory_size": "376.9mb", "memory_size_in_bytes": 395229824, "evictions": 0 }
注:去重计数 doc values起作用,fielddata为空
{
"aggs": {
"去重计数": {
"cardinality": {
"field": "username"
}
}
}
}
{
"settings" : {
"index" : {
"number_of_shards" : 20,
"number_of_replicas" : 1
}
},
"mappings":
{
"_default_":
{
"dynamic_templates": [
{
"stringNotAnalyze": {
"mapping": {
"type": "string",
"doc_values":true,
"index":"not_analyzed",
"store":false
},
"match_mapping_type": "string"
}
}
]
}
}
}
2、
terms :
{
"aggs": {
"计数": {
"terms": {
"field": "username"
}
}
}
}
3、agg统计后,kopf下看到fielddata大小
"fielddata": { "memory_size": "376.9mb", "memory_size_in_bytes": 395229824, "evictions": 0 }
注:去重计数 doc values起作用,fielddata为空
{
"aggs": {
"去重计数": {
"cardinality": {
"field": "username"
}
}
}
}
2 个回复
爱你一点点 - ELK,大数据安全,分布式扫描
赞同来自:
medcl - 今晚打老虎。
赞同来自: