Hi, I'm new to elasticsearch so there might be an obvious answer to this
question.
What's the best way to check the status of an update operation that changed
the value of an existing property?
I'm using a doc to update an existing indexed document using the java
update api:
UpdateResponse updateResponse = client.prepareUpdate("content",
"contentitem", item.id)
.setDoc(xb).execute().actionGet();
updateResponse.isCreated() only returns true if the doc was inserted using
an upsert operation and updateResponse.getGetResult() returns null null.
I've looked in the ES tests source code and the way the test is performed
there is by issuing a new get request for the updated fields and comparing
the values from ES with the values set in the update:
// change existing field
updateResponse = client().prepareUpdate(indexOrAlias(), "type1",
"1").setDoc(XContentFactory.jsonBuilder().startObject().field("field",
3).endObject()).execute().actionGet();
for (int i = 0; i < 5; i++) {
getResponse = client().prepareGet("test", "type1",
"1").execute().actionGet();
assertThat(getResponse.getSourceAsMap().get("field").toString(),
equalTo("3"));
assertThat(getResponse.getSourceAsMap().get("field2").toString(),
equalTo("2"));
}
I'm curious if this can be done just by using UpdateResponse and without
using another get.
Thanks!
--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/5f9c7a26-fba0-44d4-8f8c-401ac5c4e5e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.