I have more than 1024 clauses to match against a single field. If use terms query it is throwing max clauses count exceeded 1024. I thought of using bool query with multiple must terms to fetch all the documents that matches the clauses. but unfortunately that is not working. Is there any better approach to solve this problem. I am kind of dead locked if i use single terms query it is throwing max clause count 1024 exceeded error. I f use bool query with multiple must terms it is not matching any document at all.
Distribute your terms in 1024 portions over several queries, iterate over the returned hits to collect total hits.
Thank you @jprante. So there is no other way to get the results with out iterating through the portions of the data.
Do you really need scoring here? I think that terms query in filter position does not have 1024 clause limit.
I am doing match on raw value (not_analyzed) So i don't need scoring. It has to match the exact value. Looks like terms in filter position is not having 1024 clause limit. Thank @Maxim_Valyanskiy. That was really helpful.