Hi all,
I'm working with nested documents (like millions of documents) and I do
aggregation on nested documents. And of course, I need to use filter
aggregation
(http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-bucket-filter-aggregation.html),
however this does not seems to work with nested documents:
{
"aggs": {
"items": {
"nested": {
"path": "items"
},
"filter": {
"ids": {
"values": [
"2AA4CE67-9469-4AE7-AC99-46F7E2646C2F"
]
}
},
"aggs": {
"questions": {
"terms": {
"field": "items.question_label.raw",
"size": 0
}
}
}
}
}
}
Response:
Parse Failure [Found two aggregation type definitions in [items]: [nested]
and [filter]. Only one type is allowed.]]; }]
So, i tried an other way:
{
"query": {
"filtered": {
"filter": {
"ids": {
"values": [
"2AA4CE67-9469-4AE7-AC99-46F7E2646C2F"
]
}
}
}
},
"aggs": {
"items": {
"nested": {
"path": "items"
},
"aggs": {
"questions": {
"terms": {
"field": "items.question_label.raw",
"size": 0
}
}
}
}
}
}
In that case, this is working. But:
- it takes several seconds,
- the cache is filled up very quickly
- because the cache is full, it refuses new queries (i'm using ES 1.1.1
with Circuit Breaker)
Of course, this is not acceptable for production.
So basically, i've millions of documents but i do aggregation in my example
within a single documents containing around 100 documents with 10 fields
and... it's taking 2Gb of memory for the data cache and takes several
seconds.
My guess is, the filtering is not very useful and do aggregation on all
documents before filtering (and not the contrary as I expect).
Is there any better solution for filter aggregation with nested documents?
Many thanks!
--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/4bf1cf1d-8f4b-41f1-add1-efa952691b64%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.