Elasticsearch 7.0 Cookbook(Fourth Edition)
上QQ阅读APP看书,第一时间看更新

How to do it...

Every core type field allows you to specify custom analyzer for indexing and for searching as field parameters.

For example, if we want the name field to use a standard analyzer for indexing and a simple analyzer for searching, the mapping will be as follows:

{
"name": {
"type": "string",
"index_analyzer": "standard",
"search_analyzer": "simple"
}
}