Unexpected results when search phrase contains angular brackets

Hello ppl,

I am using:
ES 0.20.6

I created an index "some" and a type "type", with default settings,
analyzers and mapping

I have indexed the following two docs:
{"annotationText": "here are for you"}

{"annotationText": "come as you are"}

I issue the following search:
{ "query": {
"query_string": {
"query" : ""
}
},
"highlight": {
"fields": {
"annotationText": {
}
}
}
}

I get the following results:
{
"_source": {
"annotationText": "here are for you"
},
"highlight": {
"annotationText": [
"here are <some> for you"
]
}
},
{
"_source": {
"annotationText": "come as you are"
},
"highlight": {
"annotationText": [
"come as you are"
]
}
}

So you see search for "" resulted in totally irrelevant results.
Escaping < and > does not help. It results in error saying unrecognised
escape character.

What is happening here? How can i issue search query which contain < or >
and get sane results?

  • Imdad

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Could you post your mapping and settings please?

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Hi imdad,

The < sign in the beginning is interpreted by Lucene as a range query and
it becomes and open ended range query [:some] for field _all. I didn't
spend too much time looking at the code but at first glance I don't see an
escaping possibility. To be honest, I think you will be much better off
with the match query of elasticsearch - it treats the input as text and
doesn't parse it for any operator. This works for me:

{
"query": {
"match": {
"annotationText": ""
}
},
"highlight": {
"fields": {
"annotationText": {}
}
}
}

Cheers,
Boaz

On Wednesday, July 17, 2013 1:35:33 PM UTC+2, Guilherme Guitte wrote:

Could you post your mapping and settings please?

--
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.
For more options, visit https://groups.google.com/groups/opt_out.