# Club char\_filter for a regex pattern and synonyms in the same query

**URL:** https://discuss.elastic.co/t/club-char-filter-for-a-regex-pattern-and-synonyms-in-the-same-query/336383
**Category:** Elasticsearch
**Created:** [June 19, 2023, 2:53pm UTC](https://discuss.elastic.co/t/club-char-filter-for-a-regex-pattern-and-synonyms-in-the-same-query/336383 "2023-06-19T14:53:58Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![searchwithme](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/searchwithme/32/137075_2.png) [@searchwithme](https://discuss.elastic.co/u/searchwithme)
#### Post date: [June 19, 2023, 2:53pm UTC](https://discuss.elastic.co/t/club-char-filter-for-a-regex-pattern-and-synonyms-in-the-same-query/336383/1 "2023-06-19T14:53:58Z")

</div>

I have an index that has candidate resumes. Resume has 2 fields: a) name b) resume  
Name has name of candidate and resume has a blob of text like "address:""chicago.st", "skill":"python", "[email":"myemail@ymail.com](mailto:email%22:%22myemail@ymail.com)".

I want to create a mapping such that:  
a) a search ob python3 also writtens python (synonyms)  
b) apply char\_filter to convert . to dot (but I want to apply a regex in the sense the . should convert to dot only if its an email - has @ in it. there is . in the address, that should not be converted to dot.

I have my index settings to accomplish both criteria but I am not sure how to add regex to this so the @ condition is met.

PUT my-index-synonyms-1-modify-1  
{  
"settings": {  
"index": {  
"analysis": {  
"char\_filter": {  
"dot\_char\_filter": {  
"type": "pattern\_replace",  
"pattern": "\.",  
"replacement": "dot"  
}  
},  
"analyzer": {  
"my\_analyzer": {  
"type": "custom",  
"tokenizer": "standard",  
"char\_filter": ["dot\_char\_filter"],  
"filter": ["lowercase", "my\_filter"]  
}  
},  
"filter": {  
"my\_filter": {  
"type": "synonym",  
"synonyms": ["java, java2, java3"],  
"updateable": true  
}  
}  
}  
}  
},  
"mappings": {  
"properties": {  
"resume": {  
"type": "text",  
"analyzer": "standard",  
"search\_analyzer": "my\_analyzer"  
}  
}  
}  
}

Can someone help me please?

---

<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 17, 2023, 2:54pm UTC](https://discuss.elastic.co/t/club-char-filter-for-a-regex-pattern-and-synonyms-in-the-same-query/336383/2 "2023-07-17T14:54:03Z")

</div>

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