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


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",
"analyzer": {
"hash_analyzer": {
"type": "custom",
"tokenizer": "whitespace",
"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 :slight_smile:
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
To view this discussion on the web visit
For more options, visit