# How should I escape a string like /abc/

**URL:** <https://discuss.elastic.co/t/how-should-i-escape-a-string-like-abc/14658>\
**Category:** Elasticsearch\
**Created:** [December 2, 2013, 11:18am UTC](https://discuss.elastic.co/t/how-should-i-escape-a-string-like-abc/14658 "2013-12-02T11:18:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vivek\_chand\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vivek_chand_2/32/1944_2.png) [@vivek\_chand\_2](https://discuss.elastic.co/u/vivek_chand_2)\
**Post date:** [December 2, 2013, 11:18am UTC](https://discuss.elastic.co/t/how-should-i-escape-a-string-like-abc/14658/1 "2013-12-02T11:18:50Z")

</div>

Say, I did  
curl -XPUT "[http://localhost:9200/movies/movie/3](http://localhost:9200/movies/movie/3)" -d'  
{  
"title": "The Godfather",  
"director": "Francis Ford Coppola",  
"year": 1972,  
"genres": ["/abc/", "/def/"]  
}'  
And, I tried searching by  
curl -XPOST "[http://localhost:9200/\_search](http://localhost:9200/_search)" -d'  
{  
"query": {  
"filtered": {  
"query": {  
"match\_all":{}  
},  
"filter": {  
"term": { "genres": ["/abc/"] }  
}  
}  
}  
}'  
And, I got  
{"took":1,"timed\_out":false,"\_shards":{"total":5,"  
successful":5,"failed":0},"hits":{"total":0,"max\_score":null,"hits":[]}}

I also did search by escaping "/abc/" as "/abc/"  
curl -XPOST "[http://localhost:9200/\_search](http://localhost:9200/_search)" -d'  
{  
"query": {  
"filtered": {  
"query": {  
"match\_all":{}  
},  
"filter": {  
"term": { "genres": ["/abc/"] }  
}  
}  
}  
}'  
And, I got  
{"took":1,"timed\_out":false,"\_shards":{"total":5,"  
successful":5,"failed":0},"hits":{"total":0,"max\_score":null,"hits":[]}}

To Summarize, I need help on how should I escape the string "/abc/" to  
search it?

Thanks a lot,  
Vivek

--  
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/51aa8cd7-eee0-4ba0-98b0-38c78933ce6e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/51aa8cd7-eee0-4ba0-98b0-38c78933ce6e%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:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 2, 2013, 12:58pm UTC](https://discuss.elastic.co/t/how-should-i-escape-a-string-like-abc/14658/2 "2013-12-02T12:58:08Z")

</div>

I guess you should not use default analyzer (standard) for this field or don't analyze at all this field.

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 2 décembre 2013 at 12:18:54, vivek chand ([vivekchand19@gmail.com](mailto:vivekchand19@gmail.com)) a écrit:

Say, I did  
curl -XPUT "[http://localhost:9200/movies/movie/3](http://localhost:9200/movies/movie/3)" -d'  
{  
"title": "The Godfather",  
"director": "Francis Ford Coppola",  
"year": 1972,  
"genres": ["/abc/", "/def/"]  
}'  
And, I tried searching by  
curl -XPOST "[http://localhost:9200/\_search](http://localhost:9200/_search)" -d'  
{  
"query": {  
"filtered": {  
"query": {  
"match\_all":{}  
},  
"filter": {  
"term": { "genres": ["/abc/"] }  
}  
}  
}  
}'  
And, I got  
{"took":1,"timed\_out":false,"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max\_score":null,"hits":[]}}

I also did search by escaping "/abc/" as "/abc/"  
curl -XPOST "[http://localhost:9200/\_search](http://localhost:9200/_search)" -d'  
{  
"query": {  
"filtered": {  
"query": {  
"match\_all":{}  
},  
"filter": {  
"term": { "genres": ["/abc/"] }  
}  
}  
}  
}'  
And, I got  
{"took":1,"timed\_out":false,"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max\_score":null,"hits":[]}}

To Summarize, I need help on how should I escape the string "/abc/" to search it?

## Thanks a lot, Vivek

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/51aa8cd7-eee0-4ba0-98b0-38c78933ce6e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/51aa8cd7-eee0-4ba0-98b0-38c78933ce6e%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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/etPan.529c83e0.2ae8944a.b39a%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.529c83e0.2ae8944a.b39a%40MacBook-Air-de-David.local).  
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, 2:03am UTC](https://discuss.elastic.co/t/how-should-i-escape-a-string-like-abc/14658/3 "2017-07-06T02:03:55Z")

</div>


