Query multi index using Java API


I am trying to query on multiple indices using Java API. The wildcard expression is passed to the request like this

String[] indices = client.indices().get(new GetIndexRequest().indices("prefix_*"), RequestOptions.DEFAULT).indices();
SearchRequest searchRequest = new SearchRequest();

but as this wildcard term expanded to a relatively large number of index (over 1000), it returned this error:

{"error":{"root_cause":[{"type":"too_long_frame_exception","reason":"An HTTP line is larger than 4096 bytes."}],"type":"too_long_frame_exception","reason":"An HTTP line is larger than 4096 bytes."},"status":400}

When using kibana, it works perfectly as expected.

GET prefix_*/_search

How could it be done through Java API? I have been looking for proper solution from Java documentation but not found any.

Thanks in advance.

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