Java High Level Rest Client - Mutli Search API Not working with Elasticsearch 8.3.2

HI,

Im using Java High level rest client version 7.17.5. Multi Search API not working as expected. Please find the below code.

SearchSourceBuilder metaDataSearch = new SearchSourceBuilder();
        org.elasticsearch.action.search.SearchRequest metaSearch = new org.elasticsearch.action.search.SearchRequest().source(metaDataSearch).indices(indexName);

SearchSourceBuilder keywordExactRequestBuilder = new SearchSourceBuilder().size(10);
keywordExactRequestBuilder.query(QueryBuilders.matchAllQuery());
org.elasticsearch.action.search.SearchRequest keywordExactRequestSearch = new org.elasticsearch.action.search.SearchRequest().source(keywordExactRequestBuilder).indices(indexName);

MultiSearchRequest multiSearchRequest = new MultiSearchRequest()
                .add(metaSearch)
                .add(keywordExactRequestSearch);

MultiSearchResponse multiSearchResponse = null;
        try {
            multiSearchResponse = elasticClient.msearch(multiSearchRequest, RequestOptions.DEFAULT);
        } catch (IOException e) {
            e.printStackTrace();
        }

Im facing the below exception

org.jboss.resteasy.spi.UnhandledException: ElasticsearchStatusException[Elasticsearch exception [type=illegal_argument_exception, reason=key [types] is not supported in the metadata section]]
.......
Caused by: 
ElasticsearchStatusException[Elasticsearch exception [type=illegal_argument_exception, reason=key [types] is not supported in the metadata section]]
......

Im enabled API compatibility mode. Im using elasticsearch version 8.3.2

@RabBit_BR

Hi @sheiks2m

I believe it's because the code expects a "type" but it's sending "types".
I don't know if it's a mistake so open a doubt in git.

ok. Thanks

Hi I'm having the exact same issue myself.

Did you manage to find a work around / fix?

Thanks

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