Open
Description
Java API client version
7.17.6
Java version
17
Elasticsearch Version
7.17.6
Problem description
I'm trying to create a SearchRequest
from a search request expressed as json using the withJson
method.
SearchRequest sr = SearchRequest.of(b -> b .withJson(strReader).index("myindex"));
Content of json string in strReader
:
{
"_source": [ "obj1.*", "obj2.*" ],
"query": {
"match": {
"user.id": "kimchy"
}
}
}
Used with withJson
on SearchRequest throws:
co.elastic.clients.json.JsonpMappingException: Error deserializing co.elastic.clients.elasticsearch.core.SearchRequest: co.elastic.clients.json.UnexpectedJsonEventException: Unexpected JSON event 'START_ARRAY' instead of '[START_OBJECT, KEY_NAME, VALUE_STRING, VALUE_TRUE, VALUE_FALSE]' (JSON path: _source) (line no=2, column no=15, offset=16)
It is working if I limit the _source
to 1 value (no array) like "_source": "obj1.*"