# Analyzer for treating "." differently in different fields

**URL:** <https://discuss.elastic.co/t/analyzer-for-treating-differently-in-different-fields/229530>\
**Category:** Elasticsearch\
**Created:** [April 23, 2020, 6:55pm UTC](https://discuss.elastic.co/t/analyzer-for-treating-differently-in-different-fields/229530 "2020-04-23T18:55:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![telebh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/telebh/32/42272_2.png) [@telebh](https://discuss.elastic.co/u/telebh)\
**Post date:** [April 23, 2020, 6:55pm UTC](https://discuss.elastic.co/t/analyzer-for-treating-differently-in-different-fields/229530/1 "2020-04-23T18:55:03Z")

</div>

Hi There,

We have an analyzer that leaves "." as is in the case of numeric fields (i.e. 1.4.5), but some other fields (i.e. Abstract) applying this analyzer makes us losing matching documents if Abstract contains words with "." with no space (i.e. allergy.Studies). leaving "." in Abstract field for this case makes us can't run querystring on Abstract:"allergy" nor Abstract: "studies" because allergy.studies indexed with "." What analyzer can be used to leave "." as is in numeric field or other valid fields (i.e. author name, URL,...) but in other fields like Abstract replace "." with space?

Thanks

---

<div class="post-metadata">

**Author:** ![YvorL](https://avatars.discourse-cdn.com/v4/letter/y/9fc348/32.png) [@YvorL](https://discuss.elastic.co/u/YvorL)\
**Post date:** [April 23, 2020, 10:17pm UTC](https://discuss.elastic.co/t/analyzer-for-treating-differently-in-different-fields/229530/2 "2020-04-23T22:17:55Z")

</div>

Hi,

Not sure if I understand you correctly, but if you have one analyzer specified in the settings for every field, you can still add a specific one to certain fields ([doc](https://www.elastic.co/guide/en/elasticsearch/reference/current/analyzer.html)).

---

<div class="post-metadata">

**Author:** ![telebh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/telebh/32/42272_2.png) [@telebh](https://discuss.elastic.co/u/telebh)\
**Post date:** [April 27, 2020, 1:58pm UTC](https://discuss.elastic.co/t/analyzer-for-treating-differently-in-different-fields/229530/3 "2020-04-27T13:58:55Z")

</div>

the same field could contain any of the combination  
i.e. Abstract: can contain numeric value as 10.3  
Abstract can contain URL value [www.example.com](http://www.example.com)  
Abstract can contain reg text i.e. allergy.Studies ( notice no space after .)

For Abstract field, how to index 10.3 as is  
URL as is  
but for text allergy.Studies token's to allergy , studies?

---

<div class="post-metadata">

**Author:** ![YvorL](https://avatars.discourse-cdn.com/v4/letter/y/9fc348/32.png) [@YvorL](https://discuss.elastic.co/u/YvorL)\
**Post date:** [April 27, 2020, 2:43pm UTC](https://discuss.elastic.co/t/analyzer-for-treating-differently-in-different-fields/229530/4 "2020-04-27T14:43:07Z")

</div>

I see, thank you for clearing that up! I guess you can't change the pipeline to create different fields for different types (e.g., in Logstash). If I'd have this issue, I'd try to pre-process the value and assign those to different fields.

Not sure if it's the best way, but you can write a complex [regex pattern tokenizer](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-pattern-tokenizer.html). However, in your case URLs like "order.pizza" are valid and shouldn't be tokenized. So you'll have a hard time to exclude URLs from the tokenizer. Also, I don't know much about the possible inputs so this might not help, sorry.

---

<div class="post-metadata">

**Author:** ![telebh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/telebh/32/42272_2.png) [@telebh](https://discuss.elastic.co/u/telebh)\
**Post date:** [May 18, 2020, 3:45pm UTC](https://discuss.elastic.co/t/analyzer-for-treating-differently-in-different-fields/229530/5 "2020-05-18T15:45:03Z")

</div>

Thank you YvorL!

---

<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:** [June 15, 2020, 3:45pm UTC](https://discuss.elastic.co/t/analyzer-for-treating-differently-in-different-fields/229530/6 "2020-06-15T15:45:04Z")

</div>

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