parent
d5191518ba
commit
20d198fd07
|
@ -0,0 +1,22 @@
|
|||
[[java-admin-indices-get-settings]]
|
||||
==== Get Settings
|
||||
|
||||
The get settings API allows to retrieve settings of index/indices:
|
||||
|
||||
[source,java]
|
||||
--------------------------------------------------
|
||||
GetSettingsResponse response = client.admin().indices()
|
||||
.prepareGetSettings("company", "employee").get(); <1>
|
||||
for (ObjectObjectCursor<String, Settings> cursor : response.getIndexToSettings()) { <2>
|
||||
String index = cursor.key; <3>
|
||||
Settings settings = cursor.value; <4>
|
||||
Integer shards = settings.getAsInt("index.number_of_shards", null); <5>
|
||||
Integer replicas = settings.getAsInt("index.number_of_replicas", null); <6>
|
||||
}
|
||||
--------------------------------------------------
|
||||
<1> Get settings for indices `company` and `employee`
|
||||
<2> Iterate over results
|
||||
<3> Index name
|
||||
<4> Settings for the given index
|
||||
<5> Number of shards for this index
|
||||
<6> Number of replicas for this index
|
|
@ -14,3 +14,6 @@ In the rest of this guide, we will use `client.admin().indices()`.
|
|||
include::create-index.asciidoc[]
|
||||
|
||||
include::put-mapping.asciidoc[]
|
||||
|
||||
include::get-settings.asciidoc[]
|
||||
include::update-settings.asciidoc[]
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
[[java-admin-indices-update-settings]]
|
||||
==== Update Indices Settings
|
||||
|
||||
You can change index settings by calling:
|
||||
|
||||
[source,java]
|
||||
--------------------------------------------------
|
||||
client.admin().indices().prepareUpdateSettings("twitter") <1>
|
||||
.setSettings(Settings.builder() <2>
|
||||
.put("index.number_of_replicas", 0)
|
||||
)
|
||||
.get();
|
||||
--------------------------------------------------
|
||||
<1> Index to update
|
||||
<2> Settings
|
||||
|
Loading…
Reference in New Issue