Query with special characters


(Josep Floriach Ventosinos) #1

Hi guys,

First of all, sorry for possible mistakes with my english (it's not my
native language)

I'm trying to do a query in a existent index. The field I want to filter is
Id_Peticion, which has values like "676E56E8-60A1-7C83-B9C4-1C7B91E35444".
As you can guess the "-" characters are giving me problems. I'm trying to
put the backslash to scape the characters, but ES returns me entries that
not even match with the passed value. In the example above, ES returns the
following entries:

676E56E8-60A1-7C83-B9C4-1C7B91E35444 <-- Correct. It should return ONLY this.

C6334797-A70D-DA8C-7C83-27FEAE6FE3EC

84EED3FA-374A-60A1-13AE-222E9F7E11BD

...

And about 20 more entries which not match.

The query I've done:

http://otzeus.es.gasnatural.com:9200/peticiones-*/_search?q=Id_Peticion:676E56E8-60A1-7C83-B9C4-1C7B91E35444&pretty=true

I'm doing this query via browser. If I quit the backslashes the result is
exactly the same. What am I doing wrong?

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/4cec5b58-413e-49c0-8815-1d6f9989f36f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Binh Ly-2) #2

If you already haven't done so, you probably should set this field first to
not_analyzed for exact matches to work properly:

{
"mappings": {
"doc": {
"properties": {
"ld_Peticion": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}

--
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/14c43a0b-f5ff-4e04-8f7f-b57c8ef1b500%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Vladimir Khazin) #3

Id_Peticion:"676E56E8-60A1-7C83-B9C4-1C7B91E35444&pretty=truehttp://www.google.com/url?q=http%3A%2F%2Fotzeus.es.gasnatural.com%3A9200%2Fpeticiones-*%2F_search%3Fq%3DId_Peticion%3A676E56E8%5C-60A1%5C-7C83%5C-B9C4%5C-1C7B91E35444%26pretty%3Dtrue&sa=D&sntz=1&usg=AFQjCNEKnyHwt6_vqr5jvG-ggt-kKVOOpg

Did not work fro you?

--
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/8a5fcac9-ff2c-49a0-8fad-285c69994c2a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Vladimir Khazin) #4

Sorry missed the closing quote to make it a phrase instead of term query:

Id_Peticion:"676E56E8-60A1-7C83-B9C4-1C7B91E35444"&pretty=truehttp://www.google.com/url?q=http%3A%2F%2Fotzeus.es.gasnatural.com%3A9200%2Fpeticiones-*%2F_search%3Fq%3DId_Peticion%3A676E56E8%5C-60A1%5C-7C83%5C-B9C4%5C-1C7B91E35444%26pretty%3Dtrue&sa=D&sntz=1&usg=AFQjCNEKnyHwt6_vqr5jvG-ggt-kKVOOpg

--
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/050de560-d312-4e9d-9e69-69a6d5f7b8e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Josep Floriach Ventosinos) #5

That worked!! I didn't know this field parameter.

Thanks a lot.

On Friday, April 4, 2014 9:53:35 PM UTC+2, Binh Ly wrote:

If you already haven't done so, you probably should set this field first
to not_analyzed for exact matches to work properly:

{
"mappings": {
"doc": {
"properties": {
"ld_Peticion": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}

--
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/cfbeb4fb-65a3-4305-90f9-cee316838545%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #6