# Escaping special characters is not working

**URL:** https://discuss.elastic.co/t/escaping-special-characters-is-not-working/16111
**Category:** Elasticsearch
**Created:** [March 3, 2014, 2:56pm UTC](https://discuss.elastic.co/t/escaping-special-characters-is-not-working/16111 "2014-03-03T14:56:30Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Geoff\_Longman](https://avatars.discourse-cdn.com/v4/letter/g/c0e974/32.png) [@Geoff\_Longman](https://discuss.elastic.co/u/Geoff_Longman)
#### Post date: [March 3, 2014, 2:56pm UTC](https://discuss.elastic.co/t/escaping-special-characters-is-not-working/16111/1 "2014-03-03T14:56:30Z")

</div>

ES version 1.0.0  
Using logstash 1.3.3

Logs include a human readable uuid field

mapping:

- agent\_id: { type: string}

example value stored in the index

2f2f4cd7-ac07-4689-8079-2b71cde6a3bb

I've seen postings about special characters in queries and how they can be  
escaped

[http://lucene.apache.org/core/3\_4\_0/queryparsersyntax.html#Escaping%20Special%20Characters](http://lucene.apache.org/core/3_4_0/queryparsersyntax.html#Escaping%20Special%20Characters)

But if I try that technique on an index I know has many records that match  
the uuid I get no hits.

{

"query": {

```
"bool": {

  "must": [

    {

      "term": {

        "agent_id": "2f2f4cd7\\-ac07\\-4689-8079\\-2b71cde6a3bb"

      }

    }

  ],

  "must_not": [],

  "should": []

}

```

},

"from": 0,

"size": 10,

"sort": [],

"facets": {}

}

Can anyone assist?

Thanks.

--  
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/1aa00534-f787-4be6-823e-1687dedaeb3d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1aa00534-f787-4be6-823e-1687dedaeb3d%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\_2](https://avatars.discourse-cdn.com/v4/letter/b/d07c76/32.png) [@Binh\_Ly\_2](https://discuss.elastic.co/u/Binh_Ly_2)
#### Post date: [March 3, 2014, 7:38pm UTC](https://discuss.elastic.co/t/escaping-special-characters-is-not-working/16111/2 "2014-03-03T19:38:32Z")

</div>

What you probably want is to do a term query on the agent\_id.raw field:

agent\_id.raw:2f2f4cd7-ac07-4689-8079-2b71cde6a3bb

Or if you want to type it straight into the query box:

agent\_id.raw:"2f2f4cd7-ac07-4689-8079-2b71cde6a3bb"

--  
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/4e0ad559-b711-4bd3-94b7-e4e03e3df82c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4e0ad559-b711-4bd3-94b7-e4e03e3df82c%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: ![Geoff\_Longman](https://avatars.discourse-cdn.com/v4/letter/g/c0e974/32.png) [@Geoff\_Longman](https://discuss.elastic.co/u/Geoff_Longman)
#### Post date: [March 3, 2014, 8:22pm UTC](https://discuss.elastic.co/t/escaping-special-characters-is-not-working/16111/3 "2014-03-03T20:22:54Z")

</div>

sorry, that didn't work.

We are going to store the uuids without the dashes. that seems to work.

thanks for the reply!

On Monday, March 3, 2014 2:38:32 PM UTC-5, Binh Ly wrote:

> What you probably want is to do a term query on the agent\_id.raw field:
> 
> agent\_id.raw:2f2f4cd7-ac07-4689-8079-2b71cde6a3bb
> 
> Or if you want to type it straight into the query box:
> 
> agent\_id.raw:"2f2f4cd7-ac07-4689-8079-2b71cde6a3bb"

--  
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/989cbb0a-c59d-4655-bf54-9853d93858a9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/989cbb0a-c59d-4655-bf54-9853d93858a9%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: ![Geoff\_Longman](https://avatars.discourse-cdn.com/v4/letter/g/c0e974/32.png) [@Geoff\_Longman](https://discuss.elastic.co/u/Geoff_Longman)
#### Post date: [March 3, 2014, 8:23pm UTC](https://discuss.elastic.co/t/escaping-special-characters-is-not-working/16111/4 "2014-03-03T20:23:55Z")

</div>

This seems to be an issue on elasticsearch 1.0.0 only?

On Monday, March 3, 2014 3:22:54 PM UTC-5, Geoff Longman wrote:

> sorry, that didn't work.
> 
> We are going to store the uuids without the dashes. that seems to work.
> 
> thanks for the reply!
> 
> On Monday, March 3, 2014 2:38:32 PM UTC-5, Binh Ly wrote:
> 
> > What you probably want is to do a term query on the agent\_id.raw field:
> > 
> > agent\_id.raw:2f2f4cd7-ac07-4689-8079-2b71cde6a3bb
> > 
> > Or if you want to type it straight into the query box:
> > 
> > agent\_id.raw:"2f2f4cd7-ac07-4689-8079-2b71cde6a3bb"

--  
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/28eb5185-f32d-4bb6-886c-7746d8233996%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/28eb5185-f32d-4bb6-886c-7746d8233996%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: ![Geoff\_Longman](https://avatars.discourse-cdn.com/v4/letter/g/c0e974/32.png) [@Geoff\_Longman](https://discuss.elastic.co/u/Geoff_Longman)
#### Post date: [March 3, 2014, 8:27pm UTC](https://discuss.elastic.co/t/escaping-special-characters-is-not-working/16111/5 "2014-03-03T20:27:32Z")

</div>

d'oh. my test with agent\_id.raw worked. The problem was with the meat  
computer between my chair and the keyboard.

thanks for your help.

On Monday, March 3, 2014 3:23:55 PM UTC-5, Geoff Longman wrote:

> This seems to be an issue on elasticsearch 1.0.0 only?
> 
> On Monday, March 3, 2014 3:22:54 PM UTC-5, Geoff Longman wrote:
> 
> > sorry, that didn't work.
> > 
> > We are going to store the uuids without the dashes. that seems to work.
> > 
> > thanks for the reply!
> > 
> > On Monday, March 3, 2014 2:38:32 PM UTC-5, Binh Ly wrote:
> > 
> > > What you probably want is to do a term query on the agent\_id.raw field:
> > > 
> > > agent\_id.raw:2f2f4cd7-ac07-4689-8079-2b71cde6a3bb
> > > 
> > > Or if you want to type it straight into the query box:
> > > 
> > > agent\_id.raw:"2f2f4cd7-ac07-4689-8079-2b71cde6a3bb"

--  
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/1a3985c8-0a38-4089-83ba-01e8e9703760%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1a3985c8-0a38-4089-83ba-01e8e9703760%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:46am UTC](https://discuss.elastic.co/t/escaping-special-characters-is-not-working/16111/6 "2017-07-06T01:46:05Z")

</div>


