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] MultiTermVectorsOperation requires optional fields #903

Open
spacelore opened this issue Mar 21, 2024 · 0 comments
Open

[BUG] MultiTermVectorsOperation requires optional fields #903

spacelore opened this issue Mar 21, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@spacelore
Copy link

What is the bug?

The MultiTermVectorsOperation class has all fields listed as required (see the constructor where each has ApiTypeHelper.requireNonNull or ApiTypeHelper.unmodifiableRequired) that according to the documentation should be optional. I used the documentation from ElasticSearch 7.10 as there is no documentation via OpenSearch that I could find.

Additionally, the version field is a boolean in the documentation but in the client API it is of type long.

https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-multi-termvectors.html

How can one reproduce the bug?

Create a MtermvectorsRequest.Builder and add multiple MultiTermVectorsOperation objects to it. Either do not set an optional field like payloads or set both id and doc (as both are required) and the following errors are generated

When both id and doc are specified the following error occurs:

org.opensearch.client.opensearch._types.OpenSearchException: Request failed: [parse_exception] failed to parse term vectors request. either [id] or [doc] can be specified, but not both!
	at org.opensearch.client.transport.httpclient5.ApacheHttpClient5Transport.prepareResponse(ApacheHttpClient5Transport.java:503) ~[opensearch-java-2.8.1.jar:?]
	at org.opensearch.client.transport.httpclient5.ApacheHttpClient5Transport.lambda$performRequestAsync$0(ApacheHttpClient5Transport.java:178) ~[opensearch-java-2.8.1.jar:?]
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646) ~[?:?]
	at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?]
	at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2179) ~[?:?]
	at org.opensearch.client.transport.httpclient5.ApacheHttpClient5Transport$1.completed(ApacheHttpClient5Transport.java:223) ~[opensearch-java-2.8.1.jar:?]
	at org.opensearch.client.transport.httpclient5.ApacheHttpClient5Transport$1.completed(ApacheHttpClient5Transport.java:212) ~[opensearch-java-2.8.1.jar:?]

If doc is removed, then the following error occurs:

org.opensearch.client.util.MissingRequiredPropertyException: Missing required property 'MultiTermVectorsOperation.doc'
	at org.opensearch.client.util.ApiTypeHelper.requireNonNull(ApiTypeHelper.java:89) ~[opensearch-java-2.8.1.jar:?]
	at org.opensearch.client.opensearch.core.mtermvectors.MultiTermVectorsOperation.<init>(MultiTermVectorsOperation.java:85) ~[opensearch-java-2.8.1.jar:?]
	at org.opensearch.client.opensearch.core.mtermvectors.MultiTermVectorsOperation$Builder.build(MultiTermVectorsOperation.java:420) ~[opensearch-java-2.8.1.jar:?]

if id is removed, then the following error occurs:

org.opensearch.client.util.MissingRequiredPropertyException: Missing required property 'MultiTermVectorsOperation.id'
	at org.opensearch.client.util.ApiTypeHelper.requireNonNull(ApiTypeHelper.java:89) ~[opensearch-java-2.8.1.jar:?]
	at org.opensearch.client.opensearch.core.mtermvectors.MultiTermVectorsOperation.<init>(MultiTermVectorsOperation.java:89) ~[opensearch-java-2.8.1.jar:?]
	at org.opensearch.client.opensearch.core.mtermvectors.MultiTermVectorsOperation$Builder.build(MultiTermVectorsOperation.java:420) ~[opensearch-java-2.8.1.jar:?]

What is the expected behavior?

I would expect to not be required to set optional fields or be able to specify either doc or id field and have the call succeed.

What is your host/environment?

Amazon OpenSearch Service version 2.11
Java client version 2.8.1

Do you have any screenshots?

I've included stack trace snippets above.

Do you have any additional context?

We are migrating from ElasticSearch 6.8 to OpenSearch 2.x and make use of the multiterm vector capability in our search application and this is a blocker.

@spacelore spacelore added bug Something isn't working untriaged labels Mar 21, 2024
@dblock dblock removed the untriaged label Apr 16, 2024
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