Java API client version
9.4.2
Java version
17
Elasticsearch Version
9.4.2
Problem description
Issue
I'm parsing a JSON ES DSL query using the SearchRequest.of method. The _source field is a list of columns. This is a valid ES DSL query, and I can run it on Elasticsearch. However, the SearchRequest.of throws this error:
co.elastic.clients.json.JsonpMappingException: Error deserializing co.elastic.clients.elasticsearch.core.SearchRequest: Cannot determine what union member to deserialize (JSON path: _source) (line no=1, column no=142, offset=141)
If I change the _source from:
"_source":["date","distributor" ...
to:
"_source":{"includes":["date","distributor" ...
It can parse it.
Expected Outcome
Having a list in _source is a valid ES DSL query. SearchRequest should be able to parse it.
Reproduction
Here's a minimal project that reproduces the issue: https://github.com/aidin-gh/elasticsearch-source-parsing-error
Java API client version
9.4.2
Java version
17
Elasticsearch Version
9.4.2
Problem description
Issue
I'm parsing a JSON ES DSL query using the
SearchRequest.ofmethod. The_sourcefield is a list of columns. This is a valid ES DSL query, and I can run it on Elasticsearch. However, theSearchRequest.ofthrows this error:co.elastic.clients.json.JsonpMappingException: Error deserializing co.elastic.clients.elasticsearch.core.SearchRequest: Cannot determine what union member to deserialize (JSON path: _source) (line no=1, column no=142, offset=141)If I change the
_sourcefrom:to:
It can parse it.
Expected Outcome
Having a list in
_sourceis a valid ES DSL query.SearchRequestshould be able to parse it.Reproduction
Here's a minimal project that reproduces the issue: https://github.com/aidin-gh/elasticsearch-source-parsing-error