# Custom mapping some questions

**URL:** <https://discuss.elastic.co/t/custom-mapping-some-questions/194217>\
**Category:** Elasticsearch\
**Created:** [August 7, 2019, 11:04am UTC](https://discuss.elastic.co/t/custom-mapping-some-questions/194217 "2019-08-07T11:04:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![newbie1](https://avatars.discourse-cdn.com/v4/letter/n/ee7513/32.png) [@newbie1](https://discuss.elastic.co/u/newbie1)\
**Post date:** [August 7, 2019, 11:04am UTC](https://discuss.elastic.co/t/custom-mapping-some-questions/194217/1 "2019-08-07T11:04:01Z")

</div>

Hi,

I work on certification and mapping exercises.

I defined the following index with a custom analyzer.  
I wonder :

- Since the analyzer is defined in settings part, is it used for all fields ? If yes, could some one explain me how to define a such analyzer for content field only

- I try to define more than one custom char\_filter and filter but i did not find how to achieve that, is it possible ?

- is it possible to define a field which is stored in \_source but which is not indexed, is the index attribute available ?

Here is the index definition:  
PUT /an\_index  
{  
"settings": {  
"analysis": {  
"char\_filter": {  
"mychar": {  
"type": "mapping",  
"mappings": [  
"c++ =\> cpp",  
"C++ =\> cpp",  
"IT =\> _IT_"  
]  
}  
},  
"filter": {  
"myFilter": {  
"type": "stop",  
"stopwords": [  
"can",  
"we",  
"our",  
"you",  
"your",  
"all"  
]  
}  
},  
"analyzer": {  
"monanalyzer": {  
"type": "custom",  
"char\_filter": [  
"mychar"  
],  
"tokenizer": "standard",  
"filter": [  
"lowercase",  
"stop",  
"myFilter"  
]  
}  
}  
}  
},  
"mappings": {  
"\_doc": {  
"properties": {  
"author": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
},  
"category": {  
"type": "keyword",  
"ignore\_above": 256  
},  
"content": {  
"type": "text",  
"fields": {  
"monChamp": {  
"type": "text",  
"analyzer":"monanalyzer"  
}  
}  
},  
"locales": {  
"type": "keyword",  
"ignore\_above": 256  
},  
"publish\_date": {  
"type": "date"  
},  
"title": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
},  
"url": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
}  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![newbie1](https://avatars.discourse-cdn.com/v4/letter/n/ee7513/32.png) [@newbie1](https://discuss.elastic.co/u/newbie1)\
**Post date:** [August 7, 2019, 11:29am UTC](https://discuss.elastic.co/t/custom-mapping-some-questions/194217/2 "2019-08-07T11:29:33Z")

</div>

Hi,  
I found how to define several char\_filters or filters, a json question in fact.  
So still two questions :

- Since the analyzer is defined in settings part, is it used for all fields ? If yes, could some one explain me how to define a such analyzer for content field only

- is it possible to define a field which is stored in \_source but which is not indexed, is the index attribute available ?

---

<div class="post-metadata">

**Author:** ![newbie1](https://avatars.discourse-cdn.com/v4/letter/n/ee7513/32.png) [@newbie1](https://discuss.elastic.co/u/newbie1)\
**Post date:** [August 7, 2019, 11:32am UTC](https://discuss.elastic.co/t/custom-mapping-some-questions/194217/3 "2019-08-07T11:32:53Z")

</div>

Ok the "index":false is a valid attribute to a field, so the last question :

- Since the analyzer is defined in settings part, is it used for all fields ? If yes, could some one explain me how to define a such analyzer for content field only

---

<div class="post-metadata">

**Author:** ![newbie1](https://avatars.discourse-cdn.com/v4/letter/n/ee7513/32.png) [@newbie1](https://discuss.elastic.co/u/newbie1)\
**Post date:** [August 8, 2019, 6:44am UTC](https://discuss.elastic.co/t/custom-mapping-some-questions/194217/4 "2019-08-08T06:44:09Z")

</div>

No helps ? No answer ?

---

<div class="post-metadata">

**Author:** ![abdon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abdon/32/9195_2.png) [@abdon](https://discuss.elastic.co/u/abdon)\
**Post date:** [August 8, 2019, 9:23am UTC](https://discuss.elastic.co/t/custom-mapping-some-questions/194217/5 "2019-08-08T09:23:31Z")

</div>

Great questions!

> Since the analyzer is defined in settings part, is it used for all fields ? If yes, could some one explain me how to define a such analyzer for content field only

No, an analyzer is not automatically applied to all fields. If you do not define an analyzer for a field, Elasticsearch will apply the `standard` analyzer by default. If you want to apply an analyzer to for example the content field, you need to do that in the mapping by defining an `analyzer` for that field, like you're already doing with the `monChamp` multi-field.

---

<div class="post-metadata">

**Author:** ![newbie1](https://avatars.discourse-cdn.com/v4/letter/n/ee7513/32.png) [@newbie1](https://discuss.elastic.co/u/newbie1)\
**Post date:** [August 8, 2019, 1:09pm UTC](https://discuss.elastic.co/t/custom-mapping-some-questions/194217/6 "2019-08-08T13:09:49Z")

</div>

Hi Abdon,

A great thanks for your anwser.

---

<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:** [September 5, 2019, 1:09pm UTC](https://discuss.elastic.co/t/custom-mapping-some-questions/194217/7 "2019-09-05T13:09:52Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
