Terms Aggregation on long mapped field (Array) returns different results (elastic 2.3.3 and elastic 2.3.1)


(Alexander Mack) #1

Hi there,

I was wondering if someone of you folks knows the expected behaviour of the following:

I've added a new mapping on two different clusters.. One field is mapped e.g.:

..."aVirtualCategoryIDs" : {
"type" : "long",
"index" : "not_analyzed"
},...

The field contains an array of longs.. Both Clusters are feeded with the same data.

Now I'm doing a terms aggregation on it:

....
""allVCatMatches" : {"
""terms" : { "field" : "aVirtualCategoryIDs", "size" : 100 }"
"},"
....

And I'm getting two different results.

For Cluster A (Elastic Version 2.3.1):

"allVCatMatches" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 18436,
"buckets" : [ {
"key" : 200,
"doc_count" : 59274
}, {
"key" : 59,
"doc_count" : 21090
}, {
"key" : 60,
"doc_count" : 15315
},

For Cluster B (Elastic Version 2.3.3):

"allVCatMatches" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 17217,
"buckets" : [ {
"key" : "200",
"doc_count" : 57452
}, {
"key" : "59",
"doc_count" : 20987
}, {
"key" : "60",
"doc_count" : 15210
}, {
"key" : "9",
"doc_count" : 14878
}, {
"key" : "89",
"doc_count" : 11016
},

Why is the Key in one result a string and in the other result a integer / long value?

I would be happy about any help!

Thank you very much,

Alex


(Alexander Mack) #2

Hi,

for anyone in future, who has the same problem:

I only focussed on the mapping I had in my .json file (for the cluster / index setup) and was not checking the actual mapping of the index. Doing that using curl -XGET 'http://localhost:9200/YOURINDEXNAME/_mapping/YOURDOCUMENTTYPE?pretty' I saw, that the mapping was set on string with a whitespace tokenizer :expressionless:

So.. the final solution for me was using the correct json for creating the index.. not the one in some very old branch.. :wink:

Cheers,

Alex


(system) #3