[DOCS] Updates Index Management doc to include index templates (#45424) (#45792)

* [DOCS] Updates Index Management doc to include index templates

* [DOCS] Added example of creating a template

* [DOCS] Incorporates review comments

* [DOCS] Fixes typo
This commit is contained in:
gchaps 2019-09-16 12:15:09 -07:00 committed by GitHub
parent 65a9881765
commit e74e1c441d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 159 additions and 29 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 KiB

BIN
docs/images/management_index_labels.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 KiB

After

Width:  |  Height:  |  Size: 198 KiB

Before After
Before After

View file

@ -1,60 +1,190 @@
[role="xpack"]
[[managing-indices]]
== Managing Indices
== Index management
*Index Management* enables you to view index settings,
mappings, and statistics and perform index-level operations.
These include refreshing, flushing, clearing the cache, force merging segments,
freezing indices, and more. *Index Management* provides a convenient way to
perform bulk operations on multiple indices.
freezing indices, and more. Practicing good index management helps ensure
that your data is stored in the most cost-effective way possible.
To access this feature, go to *Management > {es} > Index Management*.
If security is enabled,
you must have the `monitor` cluster privilege and the `view_index_metadata`
and `manage` index privileges to view the data. See
{xpack-ref}/security-privileges.html[Security Privileges] for more
information.
*Index Management* also helps you create index templates. A template reduces
the amount of bookkeeping when working with indices. Instead of manually
setting up your indices, you can create them automatically from a template,
ensuring that your settings, mappings, and aliases are consistently defined.
*Index Management* uses badges to make users aware when an index is {ref}/frozen-indices.html[frozen],
a {ref}/ccr-put-follow.html[follower index],
or a {ref}/rollup-get-rollup-index-caps.html[rollup index].
Clicking a badge filters for all indices of that type.
To manage your indices, go to *Management > {es} > Index Management*.
[role="screenshot"]
image::images/management_index_labels.png[Index Management UI]
Clicking the name of an index displays the index summary and provides access to
the index settings, mapping, and statistics.
If security is enabled,
you must have the `monitor` cluster privilege and the `view_index_metadata`
and `manage` index privileges to view the data.
For index templates, you must have the `manage_index_templates` cluster privilege.
See {xpack-ref}/security-privileges.html[Security Privileges] for more
information.
From the *Manage* menu, you can perform these index-level operations on either
a single or multiple indices:
Before using this feature, you should be familiar with index management
operations. Refer to the {ref}/indices.html[index management APIs]
and the {ref}/indices-templates.html[index template APIs].
* *Close the index*. Blocks the index from read/write operations.
[float]
=== View and edit indices
When you open *Index Management*, youre presented an overview of your configured indices.
Badges indicate if an index is {ref}/frozen-indices.html[frozen],
a {ref}/ccr-put-follow.html[follower index],
or a {ref}/rollup-get-rollup-index-caps.html[rollup index].
Clicking a badge narrows the list to only indices of that type.
You can also filter your indices using the search bar.
You can drill down into each index to investigate the index
{ref}/index-modules.html#index-modules-settings[settings], {ref}/mapping.html[mapping], and statistics.
From this view, you can also edit the index settings.
[role="screenshot"]
image::images/management_index_details.png[Index Management UI]
[float]
=== Perform index-level operations
Use the *Manage* menu to perform index-level operations. This menu
is available in the index details view, or when you select the checkbox of one or more
indices on the overview page. The menu includes the following actions:
* *Close index*. Blocks the index from read/write operations.
A closed index exists in the cluster, but doesn't consume resources
other than disk space. If you reopen a closed index, it goes through the
normal recovery process.
* *Force merge the index*. Reduces the number of segments in your shard by
* *Force merge index*. Reduces the number of segments in your shard by
merging smaller files and clearing deleted ones. Only force merge a read-only index.
* *Refresh the index*. Writes the operations in the indexing buffer to the
filesystem cache. This is automatically done once per second. Forcing a manual
* *Refresh index*. Writes the operations in the indexing buffer to the
filesystem cache. This action is automatically performed once per second. Forcing a manual
refresh is useful during testing, but should not be routinely done in
production because it has a performance impact.
* *Clear the index cache*. Clears all caches associated with the index.
* *Clear index cache*. Clears all caches associated with the index.
* *Flush the index*. Frees memory by syncing the filesystem cache to disk and
* *Flush index*. Frees memory by syncing the filesystem cache to disk and
clearing the cache. Once the sync is complete, the internal transaction log is reset.
* *Freeze the index*. Makes the index read-only and reduces its memory footprint
by moving shards to disk. {ref}/frozen-indices.html[Frozen indices] remain
* *Freeze index*. Makes the index read-only and reduces its memory footprint
by moving shards to disk. Frozen indices remain
searchable, but queries take longer.
* *Delete the index*. Permanently removes the index and all of it's documents.
* *Delete index*. Permanently removes the index and all of its documents.
* *Add an lifecycle policy*. Specifies a policy for managing the lifecycle of the
* *Add lifecycle policy*. Specifies a policy for managing the lifecycle of the
index.
For information about the available management operations,
see {ref}/indices.html[Indices APIs].
[float]
[[manage-index-templates]]
=== Manage index templates
An index template defines {ref}/index-modules.html#index-modules-settings[settings],
{ref}/mapping.html[mappings], and {ref}/indices-add-alias.html[aliases]
that you can automatically apply when creating a new index. {es} applies a
template to a new index based on an index pattern that matches the index name.
The *Index Templates* view lists your templates and enables you to examine, edit, clone, and
delete them. Changes you make to an index template
do not affect existing indices.
[role="screenshot"]
image::images/management-index-templates.png[Index templates]
If you don't have any templates, you can create one using the *Create template* wizard.
Index templates are applied during index creation,
so you must create the
template before you create the indices.
[float]
==== Example: Create an index template
In this example, youll create an index template for randomly generated log files.
Open the *Create template* wizard, and enter `logs_template` in the *Name*
field. Set *Index pattern* to `logstash*` so the template matches any index
with that index pattern. The merge order and version are both optional,
and you'll leave them blank in this example.
[role="screenshot"]
image::images/management_index_create_wizard.png[Create wizard]
The second step in the *Create template* wizard allows you to define index settings.
These settings are optional, and this example skips this step.
The logs data set requires a
mapping to label the latitude and longitude pairs as geographic locations
by applying the geo_point type. In the third step of the wizard, define
this mapping as follows:
[source,js]
----------------------------------
{
"properties": {
"geo": {
"properties": {
"coordinates": {
"type": "geo_point"
}
}
}
}
}
----------------------------------
In the fourth step, define an alias named `logstash`.
[source,js]
----------------------------------
{
"logstash": {}
}
----------------------------------
A summary of the template is in step 5. If everything looks right, click *Create template*.
At this point, youre ready to use the {es} index API to load the logs data.
In the {kib} *Console*, index two documents:
[source,js]
----------------------------------
POST /logstash-2019.05.18/_doc
{
"@timestamp": "2019-05-18T15:57:27.541Z",
"ip": "225.44.217.191",
"extension": "jpg",
"response": "200",
"geo": {
"coordinates": {
"lat": 38.53146222,
"lon": -121.7864906
}
},
"url": "https://media-for-the-masses.theacademyofperformingartsandscience.org/uploads/charles-fullerton.jpg"
}
POST /logstash-2019.05.20/_doc
{
"@timestamp": "2019-05-20T03:44:20.844Z",
"ip": "198.247.165.49",
"extension": "php",
"response": "200",
"geo": {
"coordinates": {
"lat": 37.13189556,
"lon": -76.4929875
}
},
"memory": 241720,
"url": "https://theacademyofperformingartsandscience.org/people/type:astronauts/name:laurel-b-clark/profile"
}
----------------------------------
The mappings and alias are configured automatically based on the template. To verify, you
can view one of the newly created indices using the {ref}/indices-get-index.html#indices-get-index[index API].