How to remove field from document which matches a pattern in elasticsearch using Java? -


i have crawled few documents , created index in elasticsearch. using sense query:

this query in elasticsearch:

post /index/_update_by_query {   "script": {     "inline": "ctx._source.remove(\"home\")"   },   "query": {         "wildcard": {           "url": {             "value": "http://search.com/*"     }   } }  } 

this java program:

 client client = transportclient.builder().addplugin(reindexplugin.class)         .build().addtransportaddress(new inetsockettransportaddress(             inetaddress.getbyname("127.0.0.1"), 9300));      updatebyqueryrequestbuilder ubqrb = updatebyqueryaction.instance         .newrequestbuilder(client);      script script1 = new script("ctx._source.remove" +fieldname);      bulkindexbyscrollresponse r = ubqrb.source("index").script(script1)         .filter(wildcardquery("url", patternvalue)).get(); 

fieldname(where home saved string) name of field want remove documents. patternvalue pattern "http://search.com/*" stored. when run java program, doesn't remove home field documents. adds new field in documents called remove. might missing something. appreciated


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo