mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
parent
c992a007c8
commit
bfd072bc10
@ -41,6 +41,8 @@ PUT /my_source_index/_settings
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
// TEST[s/^/PUT my_source_index\n/]
|
||||
<1> Forces the relocation of a copy of each shard to the node with name
|
||||
`shrink_node_name`. See <<shard-allocation-filtering>> for more options.
|
||||
|
||||
@ -62,6 +64,8 @@ the following request:
|
||||
--------------------------------------------------
|
||||
POST my_source_index/_shrink/my_target_index
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
// TEST[continued]
|
||||
|
||||
The above request returns immediately once the target index has been added to
|
||||
the cluster state -- it doesn't wait for the shrink operation to start.
|
||||
@ -105,6 +109,8 @@ POST my_source_index/_shrink/my_target_index
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
// TEST[s/^/PUT my_source_index\n{"settings": {"index.blocks.write": true}}\n/]
|
||||
|
||||
<1> The number of shards in the target index. This must be a factor of the
|
||||
number of shards in the source index.
|
||||
@ -139,6 +145,6 @@ replicas and may decide to relocate the primary shard to another node.
|
||||
[float]
|
||||
=== Wait For Active Shards
|
||||
|
||||
Because the shrink operation creates a new index to shrink the shards to,
|
||||
the <<create-index-wait-for-active-shards,wait for active shards>> setting
|
||||
Because the shrink operation creates a new index to shrink the shards to,
|
||||
the <<create-index-wait-for-active-shards,wait for active shards>> setting
|
||||
on index creation applies to the shrink index action as well.
|
||||
|
@ -10,15 +10,18 @@ all indices:
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
curl localhost:9200/_stats
|
||||
GET /_stats
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
||||
Specific index stats can be retrieved using:
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
curl localhost:9200/index1,index2/_stats
|
||||
GET /index1,index2/_stats
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
// TEST[s/^/PUT index1\nPUT index2\n/]
|
||||
|
||||
By default, all stats are returned, returning only specific stats can be
|
||||
specified as well in the URI. Those stats can be any of:
|
||||
@ -74,12 +77,14 @@ Here are some samples:
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
# Get back stats for merge and refresh only for all indices
|
||||
curl 'localhost:9200/_stats/merge,refresh'
|
||||
GET /_stats/merge,refresh
|
||||
# Get back stats for type1 and type2 documents for the my_index index
|
||||
curl 'localhost:9200/my_index/_stats/indexing?types=type1,type2
|
||||
GET /my_index/_stats/indexing?types=type1,type2
|
||||
# Get back just search stats for group1 and group2
|
||||
curl 'localhost:9200/_stats/search?groups=group1,group2
|
||||
GET /_stats/search?groups=group1,group2
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
// TEST[s/^/PUT my_index\n/]
|
||||
|
||||
The stats returned are aggregated on the index level, with
|
||||
`primaries` and `total` aggregations, where `primaries` are the values for only the
|
||||
@ -91,4 +96,3 @@ Note, as shards move around the cluster, their stats will be cleared as
|
||||
they are created on other nodes. On the other hand, even though a shard
|
||||
"left" a node, that node will still retain the stats that shard
|
||||
contributed to.
|
||||
|
||||
|
@ -38,6 +38,7 @@ PUT _template/template_1
|
||||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
// TESTSETUP
|
||||
|
||||
Defines a template named template_1, with a template pattern of `te*`.
|
||||
The settings and mappings will be applied to any index name that matches
|
||||
@ -47,7 +48,7 @@ It is also possible to include aliases in an index template as follows:
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
curl -XPUT localhost:9200/_template/template_1 -d '
|
||||
PUT _template/template_1
|
||||
{
|
||||
"template" : "te*",
|
||||
"settings" : {
|
||||
@ -64,8 +65,9 @@ curl -XPUT localhost:9200/_template/template_1 -d '
|
||||
"{index}-alias" : {} <1>
|
||||
}
|
||||
}
|
||||
'
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
// TEST[s/^/DELETE _template\/template_1\n/]
|
||||
|
||||
<1> the `{index}` placeholder within the alias name will be replaced with the
|
||||
actual index name that the template gets applied to during index creation.
|
||||
@ -79,8 +81,9 @@ Index templates are identified by a name (in the above case
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
curl -XDELETE localhost:9200/_template/template_1
|
||||
DELETE /_template/template_1
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
||||
[float]
|
||||
[[getting]]
|
||||
@ -91,24 +94,26 @@ Index templates are identified by a name (in the above case
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
curl -XGET localhost:9200/_template/template_1
|
||||
GET /_template/template_1
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
||||
You can also match several templates by using wildcards like:
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
curl -XGET localhost:9200/_template/temp*
|
||||
curl -XGET localhost:9200/_template/template_1,template_2
|
||||
GET /_template/temp*
|
||||
GET /_template/template_1,template_2
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
||||
To get list of all index templates you can run:
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
curl -XGET localhost:9200/_template/
|
||||
GET /_template
|
||||
--------------------------------------------------
|
||||
|
||||
// CONSOLE
|
||||
|
||||
[float]
|
||||
[[indices-templates-exists]]
|
||||
@ -118,13 +123,13 @@ Used to check if the template exists or not. For example:
|
||||
|
||||
[source,js]
|
||||
-----------------------------------------------
|
||||
curl -XHEAD -i localhost:9200/_template/template_1
|
||||
HEAD _template/template_1
|
||||
-----------------------------------------------
|
||||
// CONSOLE
|
||||
|
||||
The HTTP status code indicates if the template with the given name
|
||||
exists or not. A status code `200` means it exists, a `404` it does not.
|
||||
|
||||
|
||||
[float]
|
||||
[[multiple-templates]]
|
||||
=== Multiple Template Matching
|
||||
@ -137,7 +142,7 @@ orders overriding them. For example:
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
curl -XPUT localhost:9200/_template/template_1 -d '
|
||||
PUT /_template/template_1
|
||||
{
|
||||
"template" : "*",
|
||||
"order" : 0,
|
||||
@ -150,9 +155,8 @@ curl -XPUT localhost:9200/_template/template_1 -d '
|
||||
}
|
||||
}
|
||||
}
|
||||
'
|
||||
|
||||
curl -XPUT localhost:9200/_template/template_2 -d '
|
||||
PUT /_template/template_2
|
||||
{
|
||||
"template" : "te*",
|
||||
"order" : 1,
|
||||
@ -165,8 +169,9 @@ curl -XPUT localhost:9200/_template/template_2 -d '
|
||||
}
|
||||
}
|
||||
}
|
||||
'
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
// TEST[s/^/DELETE _template\/template_1\n/]
|
||||
|
||||
The above will disable storing the `_source` on all `type1` types, but
|
||||
for indices of that start with `te*`, source will still be enabled.
|
||||
|
Loading…
x
Reference in New Issue
Block a user