2

I am using Jest client libraries to connect and interface with my ES cluster. I was able to injest documents to an index sucessfully and specify settings.

 Settings.Builder settings = Settings.settingsBuilder();
 settings.put("number_of_shards", 5);
 settings.put("number_of_replicas", 1);

I am having issues with updating the settings that I have specified after indexing documents. The documentation doesn't seem to be clear on how to achieve this.

Nkosi
  • 235,767
  • 35
  • 427
  • 472
enwafor
  • 101
  • 1
  • 8

1 Answers1

2

After an extensive google search, I found a solution. This can be achieved using the updatesettings class.

String body = "{ \"index\" : { " +
               "\"number_of_replicas\" :50" + ","+
               "} }";

UpdateSettings updateSettings = new UpdateSettings.Builder(body).addIndex(index).build();
enwafor
  • 101
  • 1
  • 8