You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are in a weird situation where we are facing issue while updating the document using the Elasticsearch Rest High Level Client 7.10.2 into Opensearch 2.4.0.
We are facing below error Caused by: java.io.IOException: Unable to parse response body for Response{requestLine=POST /test/_update/51?timeout=1m HTTP/1.1, host=https://<host>:9200, response=HTTP/1.1 200 OK} at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1533) at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1484) at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1454) at org.elasticsearch.client.RestHighLevelClient.update(RestHighLevelClient.java:921) at org.example.ElasticsearchTest.updateDoc(ElasticsearchTest.java:111) ... 1 more Caused by: java.lang.NullPointerException at java.base/java.util.Objects.requireNonNull(Objects.java:221) at org.elasticsearch.action.DocWriteResponse.<init>(DocWriteResponse.java:127) at org.elasticsearch.action.update.UpdateResponse.<init>(UpdateResponse.java:58) at org.elasticsearch.action.update.UpdateResponse$Builder.build(UpdateResponse.java:155) at org.elasticsearch.action.update.UpdateResponse.fromXContent(UpdateResponse.java:119) at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:1793) at org.elasticsearch.client.RestHighLevelClient.lambda$performRequestAndParseEntity$8(RestHighLevelClient.java:1455) at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1531) ... 5 more
Related component
Clients
To Reproduce
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
updateDoc(client,INDEX_NAME,DOCUMENT_ID); //pass the values
public static void updateDoc(RestHighLevelClient client, String index, String id){
try {
// Create the request
UpdateRequest request = new UpdateRequest(index, id);
// Prepare the updated fields as a Map
Map<String, Object> fieldsToUpdate = new HashMap<>();
fieldsToUpdate.put("<filed_name>", "random_value");
// ... add more fields as needed
// Set the updated fields in the request
request.doc(fieldsToUpdate);
UpdateResponse updateResponse = client.update(request, RequestOptions.DEFAULT);
// Handle the response
if (updateResponse.getResult() == DocWriteResponse.Result.UPDATED) {
System.out.println("Document updated successfully!");
} else {
// Handle other possible outcomes (created, not_found, etc.)
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
github-actionsbot
added
the
Clients
Clients within the Core repository such as High level Rest client and low level client
label
Feb 8, 2024
devkg4ai
changed the title
[BUG] Opensearch 2.x failing with Elasticsearch OSS 7.10.2 Rest High Level Client
[BUG] Opensearch 2.x failing with Elasticsearch 7.10.2 Rest High Level Client
Feb 8, 2024
Do you mean this is a documentation bug and it should say that clients should work with OpenSearch 1.x (not 2.x)? If so I will move it to https://github.com/opensearch-project/documentation-website/, but also please do feel free to just fix it there!
[Triage - attendees 12345678] @devkg4ai Thanks for filing. Thanks for creating this issue; however, it isn't being accepted due to OpenSearch 2.X not being wire compatible with ES 7.10.
It would be useful to update the documentation website if this isn't captured, or at least file an issue there as @dblock suggests
Describe the bug
Hi All,
We are in a weird situation where we are facing issue while updating the document using the Elasticsearch Rest High Level Client 7.10.2 into Opensearch 2.4.0.
We are facing below error
Caused by: java.io.IOException: Unable to parse response body for Response{requestLine=POST /test/_update/51?timeout=1m HTTP/1.1, host=https://<host>:9200, response=HTTP/1.1 200 OK} at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1533) at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1484) at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1454) at org.elasticsearch.client.RestHighLevelClient.update(RestHighLevelClient.java:921) at org.example.ElasticsearchTest.updateDoc(ElasticsearchTest.java:111) ... 1 more Caused by: java.lang.NullPointerException at java.base/java.util.Objects.requireNonNull(Objects.java:221) at org.elasticsearch.action.DocWriteResponse.<init>(DocWriteResponse.java:127) at org.elasticsearch.action.update.UpdateResponse.<init>(UpdateResponse.java:58) at org.elasticsearch.action.update.UpdateResponse$Builder.build(UpdateResponse.java:155) at org.elasticsearch.action.update.UpdateResponse.fromXContent(UpdateResponse.java:119) at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:1793) at org.elasticsearch.client.RestHighLevelClient.lambda$performRequestAndParseEntity$8(RestHighLevelClient.java:1455) at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1531) ... 5 more
Related component
Clients
To Reproduce
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
updateDoc(client,INDEX_NAME,DOCUMENT_ID); //pass the values
public static void updateDoc(RestHighLevelClient client, String index, String id){
try {
// Create the request
UpdateRequest request = new UpdateRequest(index, id);
Expected behavior
Document should be updated as per below documentation
https://opensearch.org/docs/2.11/clients/#legacy-clients
Additional Details
Plugins
opensearch-alerting
opensearch-anomaly-detection
opensearch-asynchronous-search
opensearch-cross-cluster-replication
opensearch-geospatial
opensearch-index-management
opensearch-job-scheduler
opensearch-knn
opensearch-ml
opensearch-neural-search
opensearch-notifications
opensearch-notifications-core
opensearch-observability
opensearch-performance-analyzer
opensearch-reports-scheduler
opensearch-security
opensearch-security-analytics
opensearch-sql
Host/Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: