I have created an index and added a document using java Index API.
client.prepareIndex("details", "Key", i).setSource(putJsonDocumentString(Key, Value)).execute().actionGet();
This worked fine. Index was created and document was indexed properly. Now, I need to add another document "Keys2" in this same index. So, I did this,
client.prepareUpdate("details", "Keys2", i).setScriptParams(putJsonDocumentString(Key, Value)).execute().actionGet();
But, it's not getting added to the above index. I don't want to use Bulk API (I kept getting ClusterBlockedException, which never resolved, plus I don't have much data either) I couldn't find any sample program doing the same thing.
The exception is:
ActionRequestValidationException: Validation Failed: 1: script or doc is missing
How do I resolve this?
The method putJsonDocumentString() returns a Map<string, Object> which should work with setScriptParams(), right?