Elasticsearch奇怪术语聚合 [英] Elasticsearch strange terms aggregation
问题描述
如果另一个映射包含不同类型的相同属性名称,则聚合中会有一些奇怪的术语:
There are strange terms in aggregation, if another mapping contains same property name of different type:
MAPPING
{
"mappings" : {
"access" : {
"properties" : {
"cache" : { "type" : "string" }
}
},
"foo" : {
"properties" : {
"foobar" : { "type" : "float" },
"cache" : { "type" : "integer" }
}
}
}
}
批量数据
{"create":{"_type":"foo"}}
{"foobar":[63.8828,66.3633,221.09,736.824,11.4336],"cache":[0,1536000]}
查询
curl -XGET "http://localhost:9200/test/access/_search?pretty=1" -d '{
query : { match_all : {} },
aggs : {
testagg : {
terms : {
field : "cache",
min_doc_count : 0
}
}
}
}'
结果
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
},
"aggregations" : {
"testagg" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [ {
"key" : "`\b\u0000\u0000\u0000\u0000",
"doc_count" : 0
}, {
"key" : "`\b\u0000]`\u0000",
"doc_count" : 0
}, {
"key" : "h\u0004\u0000\u0000\u0000",
"doc_count" : 0
}, {
"key" : "h\u0004\u0000.p",
"doc_count" : 0
}, {
"key" : "p\u0002\u0000\u0000",
"doc_count" : 0
}, {
"key" : "p\u0002\u0000\u0017",
"doc_count" : 0
}, {
"key" : "x\u0001\u0000",
"doc_count" : 0
} ]
}
}
}
没有AGGG查询
curl -XGET 'http://localhost:9200/test/_search?pretty=1'
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "test",
"_type" : "foo",
"_id" : "AUzS6wyGwkgefuU3DR2R",
"_score" : 1.0,
"_source":{"foobar":[63.8828,66.3633,221.09,736.824,11.4336],"cache":[0,1536000]}
} ]
}
}
我想知道为什么我会得到当我聚合空访问映射时,这些奇怪的术语……我的结构或proba是否出问题了是在Elasticsearch中发现错误吗?
I wonder why i get these strange terms when I aggregate the empty access mapping... Is there something wrong with my structure or probably a bug in Elasticsearch?
推荐答案
我通过Google搜索找到了您的问题-您和我都遇到了同样的问题。
I found your question via a google search - you and I are running into the same problem.
不幸的是,我们俩都遇到了以下错误: https://github.com/elastic/elasticsearch/issues/8614 -不同映射中的相同字段名称需要共享相同的类型。
Unfortunately, we're both suffering from this bug: https://github.com/elastic/elasticsearch/issues/8614 - identical field names in different mappings need to share the same type.
这篇关于Elasticsearch奇怪术语聚合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!