I've nested type in mappings and below doc looks like 
{ 
"id" : 1, 
"blog": "something.." 
users : [ 
{ "name","xyz", 
"id": 123 
}, 
{ "name","abc", 
"id": 235 
}
]
I want to add one more user to users array how to do that ?
https://www.elastic.co/guide/en/elasticsearch/client/java-api/6.5/java-docs-update.html 
             
            
               
               
               
            
            
           
          
            
            
              I required equivalent java code to perform below request using HighLevelRestClient and UpdateRequest
curl -X POST "localhost:9200/test/_doc/1/_update" -H 'Content-Type: application/json' -d'
 
{ 
"script" : { 
"source": "ctx._source.tags.add(params.tag)", 
"lang": "painless", 
"params" : { 
"tag" : "blue" 
} 
} 
} 
'
             
            
               
               
               
            
            
           
          
            
              
                dadoonet  
                (David Pilato)
               
              
                  
                    July 8, 2019, 10:43am
                   
                   
              3 
               
             
            
            
               
               
               
            
            
           
          
            
            
              I didn't see example adding one more object to array
             
            
               
               
               
            
            
           
          
            
              
                dadoonet  
                (David Pilato)
               
              
                  
                    July 8, 2019, 12:42pm
                   
                   
              5 
               
             
            
              I just answered to your question:
I required equivalent java code to perform below request using HighLevelRestClient and UpdateRequest
 
I did not mean to answer to "How to add one more user to users array?" question. I thought you solved it with the curl script you shared.
             
            
               
               
               
            
            
           
          
            
            
              curl is working.. i'm using  (java highlevelrestclient)
compile 'org.elasticsearch.client:elasticsearch-rest-high-level-client:6.5.4'
 
i didn't see any example java client
             
            
               
               
               
            
            
           
          
            
              
                dadoonet  
                (David Pilato)
               
              
                  
                    July 8, 2019,  2:13pm
                   
                   
              7 
               
             
            
              You probably need to upgrade. I'm not sure the method I pasted the documentation for is available with your version.
             
            
               
               
               
            
            
           
          
            
              
                system  
                (system)
                  Closed 
               
              
                  
                    August 5, 2019,  2:14pm
                   
                   
              8 
               
             
            
              This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.