# How to properly escape dashes, etc. when using snowball

**URL:** <https://discuss.elastic.co/t/how-to-properly-escape-dashes-etc-when-using-snowball/7098>\
**Category:** Elasticsearch\
**Created:** [March 22, 2012, 4:58pm UTC](https://discuss.elastic.co/t/how-to-properly-escape-dashes-etc-when-using-snowball/7098 "2012-03-22T16:58:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shane\_Witbeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shane_witbeck/32/2803_2.png) [@Shane\_Witbeck](https://discuss.elastic.co/u/Shane_Witbeck)\
**Post date:** [March 22, 2012, 4:58pm UTC](https://discuss.elastic.co/t/how-to-properly-escape-dashes-etc-when-using-snowball/7098/1 "2012-03-22T16:58:28Z")

</div>

I have an edge case where I'd like to be able to return results by  
searching for "activationkey" where it's within text like "XMLRPC  
--activationkey=\<default". I've tried escaping via backslashes  
(--activationkey\*), etc. but ideally I want to be able to just search for  
activationkey and get results.

I'm using a QueryStringSearch and snowball analyzer under the covers. Any  
suggestions on how to address this?

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [March 22, 2012, 5:11pm UTC](https://discuss.elastic.co/t/how-to-properly-escape-dashes-etc-when-using-snowball/7098/2 "2012-03-22T17:11:36Z")

</div>

On Thu, 2012-03-22 at 09:58 -0700, Shane Witbeck wrote:

> I have an edge case where I'd like to be able to return results by  
> searching for "activationkey" where it's within text like "XMLRPC  
> --activationkey=\<default". I've tried escaping via backslashes  
> (--activationkey\*), etc. but ideally I want to be able to just  
> search for activationkey and get results.
> 
> I'm using a QueryStringSearch and snowball analyzer under the covers.

You don't need the snowball analyzer - the standard analyzer will work.  
And a query-string/field/text search for 'activationkey' will work too

clint

curl -XGET '[http://127.0.0.1:9200/\_analyze?pretty=1&text=XMLRPC+--activationkey%3D\<default](http://127.0.0.1:9200/_analyze?pretty=1&text=XMLRPC+--activationkey%3D%3Cdefault)'

# [Thu Mar 22 18:11:17 2012] Response:

# {

# "tokens" : [

# {

# "end\_offset" : 6,

# "position" : 1,

# "start\_offset" : 0,

# "type" : "",

# "token" : "xmlrpc"

# },

# {

# "end\_offset" : 22,

# "position" : 2,

# "start\_offset" : 9,

# "type" : "",

# "token" : "activationkey"

# },

# {

# "end\_offset" : 31,

# "position" : 3,

# "start\_offset" : 24,

# "type" : "",

# "token" : "default"

# }

# ]

# }

---

<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, 3:35am UTC](https://discuss.elastic.co/t/how-to-properly-escape-dashes-etc-when-using-snowball/7098/3 "2017-07-06T03:35:09Z")

</div>

Closed on July 6, 2017, 3:35am UTC


