get-settings.asciidoc 1.0 KB

12345678910111213141516171819202122
  1. [[java-admin-indices-get-settings]]
  2. ==== Get Settings
  3. The get settings API allows to retrieve settings of index/indices:
  4. [source,java]
  5. --------------------------------------------------
  6. GetSettingsResponse response = client.admin().indices()
  7. .prepareGetSettings("company", "employee").get(); <1>
  8. for (ObjectObjectCursor<String, Settings> cursor : response.getIndexToSettings()) { <2>
  9. String index = cursor.key; <3>
  10. Settings settings = cursor.value; <4>
  11. Integer shards = settings.getAsInt("index.number_of_shards", null); <5>
  12. Integer replicas = settings.getAsInt("index.number_of_replicas", null); <6>
  13. }
  14. --------------------------------------------------
  15. <1> Get settings for indices `company` and `employee`
  16. <2> Iterate over results
  17. <3> Index name
  18. <4> Settings for the given index
  19. <5> Number of shards for this index
  20. <6> Number of replicas for this index