0

how to use addScriptParam while updating a document in elasticsearch using java api ,i just upgraded to newer Elasticsearch version 5.2 from version 1.6.0 i am getting compile time in the following code

for (n<-0 to followList.size-1) {
          var newObject:java.util.Map[String,Object] = Maps.newHashMap();
          var follow=followList.get(n)
          var followuuid=follow.getFollowID
          var uuidType=follow.getClassType().toString()
          newObject.put("FollowingItemUuid",followuuid)
          newObject.put("FollowingItemUuidType",uuidType)
          bulkRequest.add(client.prepareUpdate("testdb", ARTISTUSER_COLLECTION_NAME, artistUser.uuid)
          .addScriptParam("newObject", newObject)  
          .setScript(new Script(script.ScriptType.INLINE,"ctx._source.FollowingItems += newObject",null,null)))

        }

eclipse is giving error

value addScriptParam is not a member of org.elasticsearch.action.update.UpdateRequestBuilder possible cause: maybe a semicolon is missing before `value 
 addScriptParam'?

I have researched online but did not get a solution I know ES newer version changed many things in update API but I did not found any example for addScriptParam how to use addScriptParam in ES 5.2 java API ?

swaheed
  • 3,671
  • 10
  • 42
  • 103

1 Answers1

0

According to documentation, please use script(Script) method.

@Deprecated
public UpdateRequest addScriptParam(java.lang.String name, java.lang.Object value)
Deprecated. Use script(Script) instead
Add a script parameter.
Nikhil Joshi
  • 817
  • 2
  • 12
  • 34
  • i have used script over here .setScript(new Script(script.ScriptType.INLINE,"ctx._source.FollowingItems += newObject",null,null))) but i do not know how to add params in it – swaheed Aug 30 '17 at 05:35
  • Can you please update your original post with what you have tried around setScript(...) call? – Nikhil Joshi Aug 30 '17 at 11:09