Massive Nested Query

I have developed a nested query for the use of some of my clients. Unfortunately they have taken this query to the extreme use case and are searching with over 400 nested queries.

I cant see any other query that might improve on the performance of this as they want such a large volume of data.
I attempted a multiple Term aggregation (they need to search on four fields in each nested object) that would return everything but this doesn't seem like it would be better performing.

Example object
"NestedObject": [
{
"Code": "10293",
"Type": "object",
"Use": "read",
"Bool": "false"
},

{"query":{"filtered":{"filter":{"query":{"bool":{"must":[{"query_string":{"query":"Group:(1111)"}}]}}},"query":{"bool":{"must":[{"nested":{"path":"Thing","query":{"bool":{"must":[{"query_string":{"query":"Number:(2932)"}}]}}}}
]}}}},"from":0,"size":0,"_source":["DocumentId"],
"aggs":{
"nestedobject":{
"nested":{"path":"NestedObject"},
"aggs":{"meet_criteria_0":{"filter":{"bool":{"must":[{"query_string":{"query":"NestedObject.Code:(13839000) AND NestedObject.Type:(book) AND NestedObject.Bool:(false) AND (NestedObject.Use:(write) OR Snomed.Use:(read))"}}]}},"aggs":{"documents":{"reverse_nested":{},"aggs":{"distinct_record":{"top_hits":{"size":50,"_source":["DocumentId"]}}}}}},"meet_criteria_1":{".....repeat 400 times

Any suggestions?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.