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

[BUG] LengthTokenFilter.min should not be mandatory #1250

Open
robotmrv opened this issue Oct 25, 2024 · 1 comment
Open

[BUG] LengthTokenFilter.min should not be mandatory #1250

robotmrv opened this issue Oct 25, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@robotmrv
Copy link

robotmrv commented Oct 25, 2024

What is the bug?

after upgrading from opensearch-rest-high-level-client to opensearch-java client get index request fails with deserialization error.
stack trace from reproducer

Exception in thread "main" org.opensearch.client.util.MissingRequiredPropertyException: Missing required property 'LengthTokenFilter.min'
	at org.opensearch.client.util.ApiTypeHelper.requireNonNull(ApiTypeHelper.java:89)
	at org.opensearch.client.opensearch._types.analysis.LengthTokenFilter.<init>(LengthTokenFilter.java:59)
	at org.opensearch.client.opensearch._types.analysis.LengthTokenFilter.<init>(LengthTokenFilter.java:48)
	at org.opensearch.client.opensearch._types.analysis.LengthTokenFilter$Builder.build(LengthTokenFilter.java:142)
	at org.opensearch.client.opensearch._types.analysis.LengthTokenFilter$Builder.build(LengthTokenFilter.java:107)
	at org.opensearch.client.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:92)
	at org.opensearch.client.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:55)
	at org.opensearch.client.json.ObjectDeserializer$FieldObjectDeserializer.deserialize(ObjectDeserializer.java:81)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:201)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:146)
	at org.opensearch.client.json.BuildFunctionDeserializer.deserialize(BuildFunctionDeserializer.java:65)
	at org.opensearch.client.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:60)
	at org.opensearch.client.json.UnionDeserializer$SingleMemberHandler.deserialize(UnionDeserializer.java:91)
	at org.opensearch.client.json.UnionDeserializer.deserialize(UnionDeserializer.java:331)
	at org.opensearch.client.json.UnionDeserializer.deserialize(UnionDeserializer.java:285)
	at org.opensearch.client.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:55)
	at org.opensearch.client.json.JsonpDeserializerBase$StringMapDeserializer.deserialize(JsonpDeserializerBase.java:369)
	at org.opensearch.client.json.JsonpDeserializerBase$StringMapDeserializer.deserialize(JsonpDeserializerBase.java:355)
	at org.opensearch.client.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:87)
	at org.opensearch.client.json.ObjectDeserializer$FieldObjectDeserializer.deserialize(ObjectDeserializer.java:81)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:185)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:146)
	at org.opensearch.client.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:87)
	at org.opensearch.client.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:91)
	at org.opensearch.client.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:55)
	at org.opensearch.client.json.ObjectDeserializer$FieldObjectDeserializer.deserialize(ObjectDeserializer.java:81)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:185)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:146)
	at org.opensearch.client.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:87)
	at org.opensearch.client.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:91)
	at org.opensearch.client.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:55)
	at org.opensearch.client.json.ObjectDeserializer$FieldObjectDeserializer.deserialize(ObjectDeserializer.java:81)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:185)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:146)
	at org.opensearch.client.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:87)
	at org.opensearch.client.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:91)
	at org.opensearch.client.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:55)
	at org.opensearch.client.json.ObjectDeserializer$FieldObjectDeserializer.deserialize(ObjectDeserializer.java:81)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:185)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:146)
	at org.opensearch.client.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:87)
	at org.opensearch.client.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:91)
	at org.opensearch.client.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:55)
	at org.opensearch.client.transport.endpoints.DictionaryResponse.lambda$setupDictionaryResponseDeserializer$0(DictionaryResponse.java:162)
	at org.opensearch.client.json.ObjectDeserializer.parseUnknownField(ObjectDeserializer.java:214)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:183)
	at org.opensearch.client.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:146)
	at org.opensearch.client.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:87)
	at org.opensearch.client.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:91)
	at org.opensearch.client.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:55)
	at org.opensearch.client.transport.rest_client.RestClientTransport.decodeResponse(RestClientTransport.java:360)
	at org.opensearch.client.transport.rest_client.RestClientTransport.getHighLevelResponse(RestClientTransport.java:326)
	at org.opensearch.client.transport.rest_client.RestClientTransport.performRequest(RestClientTransport.java:148)
	at org.opensearch.client.opensearch.indices.OpenSearchIndicesClient.get(OpenSearchIndicesClient.java:720)
	at org.opensearch.client.opensearch.indices.OpenSearchIndicesClient.get(OpenSearchIndicesClient.java:734)
	at org.example.Main.main(Main.java:133)

How can one reproduce the bug?

use reproducer opensearch-client-index-deser.zip
run main method

What is the expected behavior?

get index request should not fail with org.opensearch.client.util.MissingRequiredPropertyException: Missing required property 'LengthTokenFilter.min' since it was never mandatory.

What is your host/environment?

Operating system, version.
using org.opensearch.client:opensearch-java:2.14.0

Do you have any additional context?

Add any other context about the problem.
initially we used elasticsearch and from its documentation it is clear
that there is default value 0 for min parameter https://www.elastic.co/guide/en/elasticsearch/reference/7.17/analysis-length-tokenfilter.html#analysis-length-tokenfilter-configure-parms

in opensearch documentation I cannot find mentions regarding default values of lenght token filter https://opensearch.org/docs/latest/analyzers/token-filters/index/
But since reproducer's index works properly looks like it is missing documentation.

@robotmrv robotmrv added bug Something isn't working untriaged labels Oct 25, 2024
@Xtansia Xtansia removed the untriaged label Oct 28, 2024
@Xtansia
Copy link
Collaborator

Xtansia commented Oct 28, 2024

Can confirm, according to opensearch-api-specification neither min nor max are required.

So can be fixed by eventual code-gen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants