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
ElasticsearchIndicesClient#getMapping(GetMappingRequest) throws on reading response when mapping contains an object property #45
Comments
Hi @sothawo , I am new to contributing to open source - can I pick this issue and start working? |
I am not maintaining this project, just reporting this issue. @swallez surely can tell you more. |
@sothawo this was a bug in the API spec that is used to generate the client code. This has been fixed in the upcoming 7.16 (I have checked that it works). The exception thrown for missing properties has also been improved in 7.16 to report not only the property name but also the class name. Since the API spec is a huge effort to formalize the Elasticsearch API, we may keep on encountering this kind of issues. I've added a way to have scoped disabling of required properties checks in order to not be blocked by this kind of issue. Yes, it's kind of a hack, but a least allows to move forward without having to wait for the next release of the client just for that 😉 |
@pullannagari as you may have seen from the comment above, it has been solved already! It's nice for you to want to contribute to open source projects. Now this project is a bit uncommon in that it has two really distinct parts:
|
@swallez I am currently adding the support for this client to Spring Data Elasticsearch and am running my integration tests against ES with both the I'm building this in a way so that in the next version of Spring Data Elasticsearch (4.4, about in a half year) the default client will still be the Addition: I will keep adding issues if I find places that do not work as supposed, that's alright? |
Thanks @swallez for taking time to look into my request, will look the advised topics further. |
@swallez I just tried it with the 7.16.0-SNAPSHOT version from the elasticsearch snapshot repository and still get the exception |
I don't see that either in 7.16, even if I build 7.16 locally directly from the code and use that jar. This is thrown for existing defined properties of a class, but the code in question sets this on the property deserializer (https://github.com/elastic/elasticsearch-java/blob/7.16/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/Property.java#L1076) which is later used in a lookahead to get the real type. There the check throwing the exception is not used. |
Finally nailed it. ES indeed sends a Fixed, verified with a unit test and an integration test. Please cross-check. |
I can confirm that this works with the 7.16.0-SNAPSHOT. |
Hi @swallez , {
"settings":{
"index":{
"number_of_shards":"2",
"number_of_replicas":"0",
"analysis":{
"analyzer":{
"de_stop":{
"filter":[
"lowercase",
"german_normalization"
],
"tokenizer":"standard"
}
}
}
}
},
"mappings":{
"dynamic":"strict",
"properties":{
"title":{
"type":"keyword"
}
}
}
} The stacktrace reads like:
Should I open a new bug report for this one or could this be addressed here? Thanks for your help. |
@LordOfTheHelmet please open a new issue as this is a different issue from this one. Thanks! |
Using version 7.15.2.
When an index mapping contains a property that is an object,
co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient#getMapping(co.elastic.clients.elasticsearch.indices.GetMappingRequest)
crashes on parsing the result.This can be tested with the following code:
This will produce the following error:
The mapping returned from the server:
I debugged through the code; when reading the properties, the parser comes to the
name
entry and then on finding a START_OBJECT tries to get thetype
property of the object, basically expecting something likeEven when the mapping is stored explicitly in Elasticsearch with the type object, it is not returned on getting the mapping.
The text was updated successfully, but these errors were encountered: