Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getFieldMapping error when several fields #166

Closed
OlivierRo opened this issue Feb 21, 2022 · 6 comments · Fixed by #344
Closed

getFieldMapping error when several fields #166

OlivierRo opened this issue Feb 21, 2022 · 6 comments · Fixed by #344
Labels
Area: Specification Related to the API spec used to generate client code

Comments

@OlivierRo
Copy link

OlivierRo commented Feb 21, 2022

(ElasticSearch java client 7.17.0)
When asking for several fields mapping at once with new Java client API
GetFieldMappingResponse response = client.indices().getFieldMapping(g -> g.index("dt_xdf_wet_tropo_pre").fields("id", "uri"));
get following exception :
`co.elastic.clients.json.UnexpectedJsonEventException: Unexpected JSON event 'KEY_NAME' instead of 'END_OBJECT'

at co.elastic.clients.json.JsonpUtils.expectEvent(JsonpUtils.java:57)
at co.elastic.clients.json.JsonpUtils.expectNextEvent(JsonpUtils.java:51)
at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:197)
at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:137)
at co.elastic.clients.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:75)
at co.elastic.clients.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:79)
at co.elastic.clients.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:43)
at co.elastic.clients.json.ObjectDeserializer$FieldObjectDeserializer.deserialize(ObjectDeserializer.java:72)
at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:176)
at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:137)
at co.elastic.clients.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:75)
at co.elastic.clients.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:79)
at co.elastic.clients.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:43)
at co.elastic.clients.transport.endpoints.DictionaryResponse.lambda$setupDictionaryResponseDeserializer$0(DictionaryResponse.java:148)
at co.elastic.clients.json.ObjectDeserializer.parseUnknownField(ObjectDeserializer.java:205)
at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:174)
at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:137)
at co.elastic.clients.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:75)
at co.elastic.clients.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:79)
at co.elastic.clients.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:43)
at co.elastic.clients.transport.rest_client.RestClientTransport.decodeResponse(RestClientTransport.java:325)
at co.elastic.clients.transport.rest_client.RestClientTransport.getHighLevelResponse(RestClientTransport.java:291)
at co.elastic.clients.transport.rest_client.RestClientTransport.performRequest(RestClientTransport.java:144)
at co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient.getFieldMapping(ElasticsearchIndicesClient.java:1062)

`
With only one field, it is ok

@sbrunot
Copy link

sbrunot commented May 3, 2022

I also reproduced this issue with the following code:

RestClient restClient = RestClient.builder(new HttpHost("localhost", 9200)).build();
ObjectMapper om = new ObjectMapper();
JsonpMapper mapper = new JacksonJsonpMapper(om);
ElasticsearchTransport transport = new RestClientTransport(restClient, mapper);
ElasticsearchClient client = new ElasticsearchClient(transport);
GetFieldMappingRequest gfmRequest =  new GetFieldMappingRequest.Builder()
		.index("*")
		.fields("*")
		.build();
GetFieldMappingResponse gfmResponse = client.indices().getFieldMapping(gfmRequest);

@swallez swallez added the Area: Specification Related to the API spec used to generate client code label Jun 22, 2022
swallez added a commit to elastic/elasticsearch-specification that referenced this issue Jun 28, 2022
* Fix MultiTermsRequest - elastic/elasticsearch-java#160
* TypeFieldMappings is a multi-key dictionary - elastic/elasticsearch-java#166
* Fix TranslateSqlResponse - elastic/elasticsearch-java#167
* Token filter properties are generally optional - elastic/elasticsearch-java#199
* Fix typo in IndexSettings.mapping and allow extended settings - elastic/elasticsearch-java#295
* ShardRecovery.stop_time_in_millis is optional - elastic/elasticsearch-java#202
swallez added a commit to elastic/elasticsearch-specification that referenced this issue Jun 28, 2022
* Fix MultiTermsRequest - elastic/elasticsearch-java#160
* TypeFieldMappings is a multi-key dictionary - elastic/elasticsearch-java#166
* Fix TranslateSqlResponse - elastic/elasticsearch-java#167
* Token filter properties are generally optional - elastic/elasticsearch-java#199
* Fix typo in IndexSettings.mapping and allow extended settings - elastic/elasticsearch-java#295
* ShardRecovery.stop_time_in_millis is optional - elastic/elasticsearch-java#202
swallez added a commit to elastic/elasticsearch-specification that referenced this issue Jun 28, 2022
* Fix MultiTermsRequest - elastic/elasticsearch-java#160
* TypeFieldMappings is a multi-key dictionary - elastic/elasticsearch-java#166
* Fix TranslateSqlResponse - elastic/elasticsearch-java#167
* Token filter properties are generally optional - elastic/elasticsearch-java#199
* Fix typo in IndexSettings.mapping and allow extended settings - elastic/elasticsearch-java#295
* ShardRecovery.stop_time_in_millis is optional - elastic/elasticsearch-java#202
@OlivierRo
Copy link
Author

OlivierRo commented Jul 13, 2022 via email

@swallez
Copy link
Member

swallez commented Jul 13, 2022

This will be released in versions 8.4.0 and 7.17.6. In the meantime, it is already available in 7.17.6-SNAPSHOT from the snapshot repository at https://snapshots.elastic.co/maven/

@OlivierRo
Copy link
Author

OlivierRo commented Jul 13, 2022 via email

@OlivierRo
Copy link
Author

OlivierRo commented Jul 15, 2022 via email

@allanpoola
Copy link

how long it usually takes to get released package from Maven repository? Still waiting 7.17.6 to be released via mvn...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Specification Related to the API spec used to generate client code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants