# Make elastic treat "c#" and "c++" differently

**URL:** <https://discuss.elastic.co/t/make-elastic-treat-c-and-c-differently/20266>\
**Category:** Elasticsearch\
**Created:** [October 15, 2014, 1:21pm UTC](https://discuss.elastic.co/t/make-elastic-treat-c-and-c-differently/20266 "2014-10-15T13:21:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kiran\_Sriharsha](https://avatars.discourse-cdn.com/v4/letter/k/e36b37/32.png) [@Kiran\_Sriharsha](https://discuss.elastic.co/u/Kiran_Sriharsha)\
**Post date:** [October 15, 2014, 1:21pm UTC](https://discuss.elastic.co/t/make-elastic-treat-c-and-c-differently/20266/1 "2014-10-15T13:21:17Z")

</div>

Hello

I need elasticsearch return considerably different results when searched  
for "c#" and "c++".

After going through documenation/stackoverflow and few trail and errors, I  
implemented custom analyzer that will consider # and + as ALPHANUM.  
Now I am getting better results. But, few of my results even now contain  
"c++" WITHOUT "c#" text when searched with "c#".

_Below is my analyzer:_  
"settings": {  
"analysis": {  
"filter": {  
"hash\_filter": {  
"type": "word\_delimiter",  
"type\_table": [  
"# =\> ALPHANUM",  
"+ =\> ALPHANUM",  
". =\> ALPHANUM"  
],  
"split\_on\_numerics":"false"  
}  
},  
"analyzer": {  
"hash\_analyzer": {  
"type": "custom",  
"tokenizer": "whitespace",  
"filter": [  
"lowercase",  
"hash\_filter"  
],  
"char\_filter": "html\_strip"  
}  
}  
}

_Below is the dummy mapper:_  
"mapping": {  
"myIndex": {  
"\_all": {  
"enabled": "true",  
"index": "analyzed"  
},  
"properties": {  
"description": {  
"type": "string",  
"index": "analyzed",  
"analyzer": "hash\_analyzer"  
}  
}  
}  
}

Please provide me tips on how to improve so that I can get better results.

Thank you 🙂  
Sri Harsha

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/e076367b-67ed-4c18-a68e-7ed0a8e54cbf%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e076367b-67ed-4c18-a68e-7ed0a8e54cbf%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 12:56am UTC](https://discuss.elastic.co/t/make-elastic-treat-c-and-c-differently/20266/2 "2017-07-06T00:56:03Z")

</div>

Closed on July 6, 2017, 12:56am UTC


