# How to set analyzer in elasticsearch.yml

**URL:** <https://discuss.elastic.co/t/how-to-set-analyzer-in-elasticsearch-yml/60073>\
**Category:** Elasticsearch\
**Created:** [September 8, 2016, 12:38pm UTC](https://discuss.elastic.co/t/how-to-set-analyzer-in-elasticsearch-yml/60073 "2016-09-08T12:38:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![WangXiangUSTC](https://avatars.discourse-cdn.com/v4/letter/w/8dc957/32.png) [@WangXiangUSTC](https://discuss.elastic.co/u/WangXiangUSTC)\
**Post date:** [September 8, 2016, 12:38pm UTC](https://discuss.elastic.co/t/how-to-set-analyzer-in-elasticsearch-yml/60073/1 "2016-09-08T12:38:17Z")

</div>

default, elasticsearch use standard analyzer to every fields. But I only want to analyzer the fields "message", and other fields use non\_analyzer, I don't know the all fields in the index, only "message" is fixed, other fields are parsed from "message".  
so, how to config in the .yml file?

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [September 8, 2016, 12:59pm UTC](https://discuss.elastic.co/t/how-to-set-analyzer-in-elasticsearch-yml/60073/2 "2016-09-08T12:59:46Z")

</div>

Check out dynamic templates [1] You can write rules for how new fields are to be treated. You can match on the JSON type of the new field or use an expression to match the name.

> [@WangXiangUSTC](#):
>
> how to config in the .yml file?

Use the API not .yml files to do this

[1] [Customizing Dynamic Mapping | Elasticsearch: The Definitive Guide [2.x] | Elastic](https://www.elastic.co/guide/en/elasticsearch/guide/2.x/custom-dynamic-mapping.html#dynamic-templates)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:21pm UTC](https://discuss.elastic.co/t/how-to-set-analyzer-in-elasticsearch-yml/60073/3 "2017-07-05T22:21:50Z")

</div>


