Aggregations strange behaviour


(Vitor Loureiro) #1

Hi guys,

I want to do an aggregation over documents similar to this one:

{
"name": test,
"id": "1",
"provider":{
"id": "1"
"name": "test provider"
}
}

Now when I do a simple aggregation over the documents like:

{
"aggs": {
"test": {
"terms": {
"field": "provider.name"
},
"aggs": {
"results": {
"top_hits": {
"size": 1
}
}
}
}
}
}

Instead of looking to the property "provider.name" the aggregation is looking to the "root" property "name".

If I change the property "name" inside provider to, for example, "providerName" and I change the aggregation to look in "provider.providername" it works fine.

This behaviour started happening when upgrading from elasticSearch 1.3.4 to version 1.7.0

Do you have any thoughts on this?

Regards,

Vitor


(Colin Goodheart-Smithe) #2

Is your document type also called provider? if so you are probably running into the ambiguous field lookup problem described here: https://www.elastic.co/blog/great-mapping-refactoring#ambiguous-fields


(Vitor Loureiro) #3

Hi colings86,

No the document type has a different name.
But the problem can be related to ambiguity somehow...

But it worked fine in version 1.3.4
That is why I wanted to know if something changed in this regard between those versions.

Regards,

Vitor


(Vitor Loureiro) #4

Actually that was the problem colings86 :smile:

I have a document type called "provider" inside the same index...
I'm going to change that and add the provider type in a separate index.

Thanks,

Vitor


(system) #5