# Word delimiter filter - ignore words with hyphen

**URL:** <https://discuss.elastic.co/t/word-delimiter-filter-ignore-words-with-hyphen/15430>\
**Category:** Elasticsearch\
**Created:** [January 27, 2014, 9:47am UTC](https://discuss.elastic.co/t/word-delimiter-filter-ignore-words-with-hyphen/15430 "2014-01-27T09:47:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patrick\_Norwood](https://avatars.discourse-cdn.com/v4/letter/p/ecd19e/32.png) [@Patrick\_Norwood](https://discuss.elastic.co/u/Patrick_Norwood)\
**Post date:** [January 27, 2014, 9:47am UTC](https://discuss.elastic.co/t/word-delimiter-filter-ignore-words-with-hyphen/15430/1 "2014-01-27T09:47:48Z")

</div>

Hi all,

I would really appreciate if anyone could navigate me, how I should set my  
word\_delimiter\_filter to skip words containing hyphen? The desired result  
is that the word with '-' in them, will be ignored by word delimiter filter.  
One possible way that I tried to implement was using protected\_words option  
with regular expression - but I am not sure whether this is possible.  
My settings for word\_delimiter\_filter are as follows:  
:word\_delimiter\_filter =\> {  
"type" =\> 'word\_delimiter',  
"preserve\_original" =\> true,  
"generate\_number\_parts" =\> false,  
"split\_on\_case\_change" =\> false,  
"split\_on\_numerics" =\> false,  
}

I tried adding this: "protected\_words" =\> [/._-._/] ...but it did not  
work.

Is there any way to achieve this? Thanks in advance.

--  
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/be0e2372-491f-423a-8a05-d1a2400e622f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/be0e2372-491f-423a-8a05-d1a2400e622f%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@Binh\_Ly](https://discuss.elastic.co/u/Binh_Ly)\
**Post date:** [January 27, 2014, 2:53pm UTC](https://discuss.elastic.co/t/word-delimiter-filter-ignore-words-with-hyphen/15430/2 "2014-01-27T14:53:00Z")

</div>

Patrick,

If I understand correctly, you just want to preserve the dashes as is and  
not "word-delimit" on them. You can try something like this (I am just  
preserving the - symbol: \u002D):

```
  "analysis": {
    "analyzer": {
      "wd1": {
        "tokenizer": "whitespace",
        "filter": [
          "wd1"
        ]
      }
    },
    "filter": {
      "wd1": {
        "type": "word_delimiter",
        "type_table": [
          "\\u002D => ALPHANUM"
        ]
      }
    }
  }

```

--  
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/8bb175ed-eb4e-4824-9d54-82439383779b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8bb175ed-eb4e-4824-9d54-82439383779b%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 1:54am UTC](https://discuss.elastic.co/t/word-delimiter-filter-ignore-words-with-hyphen/15430/3 "2017-07-06T01:54:35Z")

</div>


