Escaping special characters is not working


(Geoff Longman) #1

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

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.
To view this discussion on the web visit 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.


(Binh Ly-2) #2

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.
To view this discussion on the web visit 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.


(Geoff Longman) #3

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.
To view this discussion on the web visit 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.


(Geoff Longman) #4

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.
To view this discussion on the web visit 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.


(Geoff Longman) #5

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.
To view this discussion on the web visit 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.


(system) #6