Mappings are not getting updated in ElasticSearch using java code -
i have tried updating mappings in elastic search using java code. dismay mappings not getting updated
following code
string settingsasjson =getjsonstring("settingfile"); client.admin().indices().close(new closeindexrequest(indexname)).actionget().isacknowledged(); boolean settingsack = client.admin().indices().prepareupdatesettings().setsettings(settingsasjson).setindices(indexname).execute().actionget().isacknowledged(); system.out.println("applied settings "+ settingsack); string mappingasjson = getjsonstring("mappingfile"); boolean mappingack = client.admin().indices().prepareputmapping().setindices(indexname).settype(indextype).setsource(mappingasjson).execute().actionget().isacknowledged(); system.out.println("applied mappings "+ mappingack); client.admin().indices().open(new openindexrequest(indexname)); client.admin().indices().prepareflush(indexname);
following mapping file
{ "profiles": { "dynamic" : "true", "_all": { "type": "string", "analyzer": "standard" }, "properties": { "employee_id": { "type": "integer", "analyzer":"standard" } } } }
also note, dynamic property changes rest new updation on mappings dont updated. there other way update mappings using java code?
Comments
Post a Comment