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] Inconsistency between java client and OpenSearch update by query responses #387

Open
aprousas opened this issue Dec 4, 2024 · 0 comments · May be fixed by #388
Open

[BUG] Inconsistency between java client and OpenSearch update by query responses #387

aprousas opened this issue Dec 4, 2024 · 0 comments · May be fixed by #388
Assignees
Labels
bug Something isn't working

Comments

@aprousas
Copy link

aprousas commented Dec 4, 2024

What is the bug?

I notice an inconsistency to the responses between the java client and the actual OpenSearch response when I try to update by query.

When executing an update_by_query request using the Java client, the returned ByQueryResponse object reports an updated count of 0. However the OpenSearch response for the same query returns an updated count of 1.

More specifically, the OpenSearch response:

{
  "took": 190,
  "timed_out": false,
  "total": 1,
  "updated": 1,
  "deleted": 0,
  "batches": 1,
  "version_conflicts": 0,
  "noops": 0,
  "retries": {
    "bulk": 0,
    "search": 0
  },
  "throttled_millis": 0,
  "requests_per_second": -1,
  "throttled_until_millis": 0,
  "failures": []
}

And the java client response:

result = {ByQueryResponse@15427} 
   took = 172
   timedOut = false
   total = 1
   updated = 0
   deleted = 0
   batches = 1
   versionConflicts = 0
   noops = 0
   bulkRetries = 0
   searchRetries = 0
   reasonCancelled = null
   failures = {ArrayList@15429}  size = 0
   searchFailures = {Collections$EmptyList@15430}  size = 0

So the problem is that the java client returns updated = 0 but OpenSearch returns updated = 1 although we run the same query using the same method (update by query).

What is the expected behavior?

The query response should be the same between OpenSearch and the java client.

What is your host/environment?

  • java version 17
  • spring-data-opensearch-starter version 1.5.4 (excluding opensearch-rest-high-level-client)
  • opensearch-java version 2.18.0

Do you have any additional context?

After some investigation, I suspect that the byQueryResponse method in the org.opensearch.data.client.osc.ResponseConverter class might be responsible for the discrepancy. In this method the updated field value of the builder is never set. Although the rest of the fields( eg total, deleted, etc) are set as expected.
Shouldn't it also include the updated field?

@aprousas aprousas added bug Something isn't working untriaged labels Dec 4, 2024
@reta reta removed the untriaged label Dec 4, 2024
@reta reta self-assigned this Dec 4, 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
2 participants