Replace `IndexRequest.Builder.value()` call with call to `.document()` to reflect current state of API (#2658)

Please double-check that this is correct. I'm using `org.opensearch.client:opensearch-java:2.2.0` and `org.opensearch.client:opensearch-rest-client:2.5.0` to try to create a client as per the docs. I noticed that the call to `IndexRequest.Builder.value()` does not work. I believe the correct method name is ``IndexRequest.Builder.document()`
This commit is contained in:
Nick Baughman 2023-02-07 14:08:03 -05:00 committed by GitHub
parent a1469d0cf5
commit 901bc63959
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -172,7 +172,7 @@ You can index data into OpenSearch using the following code:
```java
IndexData indexData = new IndexData("first_name", "Bruce");
IndexRequest<IndexData> indexRequest = new IndexRequest.Builder<IndexData>().index(index).id("1").value(indexData).build();
IndexRequest<IndexData> indexRequest = new IndexRequest.Builder<IndexData>().index(index).id("1").document(indexData).build();
client.index(indexRequest);
```
{% include copy.html %}
@ -283,7 +283,7 @@ public class OpenSearchClientExample {
//Index some data
IndexData indexData = new IndexData("first_name", "Bruce");
IndexRequest<IndexData> indexRequest = new IndexRequest.Builder<IndexData>().index(index).id("1").value(indexData).build();
IndexRequest<IndexData> indexRequest = new IndexRequest.Builder<IndexData>().index(index).id("1").document(indexData).build();
client.index(indexRequest);
//Search for the document