Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

composite and cardinality, it can't run in string type #29651

Closed
EnglishVillage opened this issue Apr 23, 2018 · 4 comments
Closed

composite and cardinality, it can't run in string type #29651

EnglishVillage opened this issue Apr 23, 2018 · 4 comments

Comments

@EnglishVillage
Copy link

Describe the feature:
first composite agg,then cardinality agg.
can't run in string type, cardinality result always = 0

Elasticsearch version (bin/elasticsearch --version):
6.2.2

Plugins installed: []
analysis-pinyin(chinese) and sql

JVM version (java -version):
1.8.0_111

OS version (uname -a if on a Unix-like system):
test server:
Linux testes1 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
server:
Linux server1 3.10.0-327.22.2.el7.x86_64 #1 SMP Thu Jun 23 17:05:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Description of the problem including expected versus actual behavior:
if long type or date type, it can run.
but string type,it cat't run...

Steps to reproduce:

Please include a minimal but complete recreation of the problem, including
(e.g.) index creation, mappings, settings, query etc. The easier you make for
us to reproduce it, the more likely that somebody will take the time to look at it.

mappings:
{
"import_bidding": {
"dynamic_templates": [
{
"stringfield": {
"mapping": { "type" : "keyword", "doc_values": "false" },
"match_mapping_type": "string",
"match": "*"
}
}
],
"properties": {
"province": { "type" : "keyword" },
"innCN": { "type" : "keyword" },
"companyNameN": { "type" : "keyword" },
"unitPrice": { "type" : "double" }
}
}
}
2.
settings:
{
"settings": {
"index.mapping.coerce": true,
"index.mapping.ignore_malformed": false,
"index.number_of_shards": 3
}
}
3.
query:
{
"size": 0,
"timeout": "5m",
"aggregations": {
"innCN": {
"composite": {
"size": 10,
"sources": [{
"innCN": {
"terms": {
"field": "innCN",
"order": "asc"
}
}
}, {
"companyNameN": {
"terms": {
"field": "companyNameN",
"order": "asc"
}
}
}]
},
"aggregations": {
"unitPrice": {
"percentiles": {
"field": "unitPrice",
"percents": [50.0],
"keyed": true,
"tdigest": {
"compression": 100.0
}
}
},
"province": {
"cardinality": {
"field": "province",
"precision_threshold": 300
}
}
}
}
}
}
4.
result:
province value should > 0
[{innCN=阿司匹林, companyNameN=万邦德制药集团股份有限公司, unitPrice=0.0195, province=0.0}, {innCN=阿司匹林, companyNameN=上海上药信谊药厂有限公司, unitPrice=0.03475, province=0.0}, {innCN=阿司匹林, companyNameN=上海信谊百路达药业有限公司, unitPrice=0.042, province=0.0}, {innCN=阿司匹林, companyNameN=上海华源制药股份有限公司, unitPrice=0.048, province=0.0}, {innCN=阿司匹林, companyNameN=临汾宝珠制药有限公司, unitPrice=0.0409, province=0.0}, {innCN=阿司匹林, companyNameN=丹东医创药业有限责任公司, unitPrice=0.0197, province=0.0}, {innCN=阿司匹林, companyNameN=云南白药集团股份有限公司, unitPrice=0.047, province=0.0}, {innCN=阿司匹林, companyNameN=亚宝药业集团股份有限公司, unitPrice=0.026, province=0.0}, {innCN=阿司匹林, companyNameN=亿帆医药股份有限公司, unitPrice=0.158, province=0.0}, {innCN=阿司匹林, companyNameN=内蒙古通辽制药股份有限公司, unitPrice=0.08, province=0.0}]

Provide logs (if relevant):

@javanna
Copy link
Member

javanna commented Apr 23, 2018

hi @EnglishVillage could you add an example document, and clarify what the expected result should be compared to what you are getting? Thank you.

@jimczi
Copy link
Contributor

jimczi commented Apr 23, 2018

This is a side effect of #28688.
Sub-aggregations with specific behavior in preProcess and postProcess don't work well with composite in 6.2. This issue has been fixed in a refactoring which will be available in 6.3 (the next minor release of 6.x):
#28745
Thanks for reporting @EnglishVillage

@javanna
Copy link
Member

javanna commented Apr 23, 2018

ok thanks for the help @jimczi I am closing this then given that it's already fixed.

@javanna javanna closed this as completed Apr 23, 2018
@jimczi
Copy link
Contributor

jimczi commented Apr 23, 2018

Thanks @javanna

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants