Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCS] Add default index-time analyzer example #50501

Merged
merged 1 commit into from
Jan 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 38 additions & 3 deletions docs/reference/analysis.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ to the inverted index:
[[specify-index-time-analyzer]]
=== Specifying an index time analyzer

{es} determines which index-time analyzer to use by
checking the following parameters in order:

. The <<analyzer,`analyzer`>> mapping parameter of the field
. The `default` analyzer parameter in the index settings

If none of these parameters are specified, the
<<analysis-standard-analyzer,`standard` analyzer>> is used.

[discrete]
[[specify-index-time-field-analyzer]]
==== Specify the index-time analyzer for a field

Each <<text,`text`>> field in a mapping can specify its own
<<analyzer,`analyzer`>>:

Expand All @@ -53,10 +66,32 @@ PUT my_index
}
-------------------------

At index time, if no `analyzer` has been specified, it looks for an analyzer
in the index settings called `default`. Failing that, it defaults to using
the <<analysis-standard-analyzer,`standard` analyzer>>.
[discrete]
[[specify-index-time-default-analyzer]]
==== Specify a default index-time analyzer

When <<indices-create-index,creating an index>>, you can set a default
index-time analyzer using the `default` analyzer setting:

[source,console]
----
PUT my_index
{
"settings": {
"analysis": {
"analyzer": {
"default": {
"type": "whitespace"
}
}
}
}
}
----

A default index-time analyzer is useful when mapping multiple `text` fields that
use the same analyzer. It's also used as a general fallback analyzer for both
index-time and search-time analysis.

[float]
== Search time analysis
Expand Down