Throws HTTP line is larger than 4096 bytes when searching for 200 indices in a single request

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):

opensearch 2.9.0

Describe the issue:

We have an use case where we can search from all the indices and When we pass all the indices to opensearch query, it throws HTTP line is larger than 4096 bytes, because it appends all the indices in request URI.

Is there a way we can pass all the indices in body not in the Request URI?

Configuration:

Relevant Logs or Screenshots:

org.opensearch.OpenSearchStatusException: OpenSearch exception [type=too_long_http_line_exception, reason=An HTTP line is larger than 4096 bytes.]
	at org.opensearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:209) ~[opensearch-2.9.0.jar:2.9.0]
	at org.opensearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:2235) ~[opensearch-rest-high-level-client-2.9.0.jar:2.9.0]
	at org.opensearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:2212) ~[opensearch-rest-high-level-client-2.9.0.jar:2.9.0]
	at org.opensearch.client.RestHighLevelClient$1.onFailure(RestHighLevelClient.java:2123) [opensearch-rest-high-level-client-2.9.0.jar:2.9.0]
	at org.opensearch.client.RestClient$FailureTrackingResponseListener.onDefinitiveFailure(RestClient.java:707) [opensearch-rest-client-2.9.0.jar:2.9.0]

Hey @ss_open

Couple ways I know of to query all indexes is by using a wildcard like this:

http://localhost:9200/some_index-*/_search?pretty

Another way is by leveraging your aliases and put your indexes behind the some_alias:

POST /_aliases
{
  "actions" : [
    { "add" : { "index" : " some_indices-*", "alias" : "some_alias" } }
  ]
}

After running that you can query the alias directly.

Example:

http://localhost:9200/some_alias/_search?pretty