Hello,
I recently discovered very interesting problem

The analyzer is *whitespace:*
{
  "mappings": {
    "test": {
      "properties": {
        "title": {
          "analyzer": "whitespace",
          "type": "string"
        },
        "description": {
          "analyzer": "whitespace",
          "type": "string"
        }
      }
    }
  }
}


I have 3 documents with the following content:
{
    "id": 1,
    "title" : "testing123",
    "description" : "a description"
}
{
    "id": 2,
    "title" : "testing >end",
    "description" : "another description"
}
{
    "id": 3,
    "title" : "testing <end",
    "description" : "another description"
}


Then I did the following search queries:
{
  "query": {

    "bool": {
      "should": [
        {
          "query_string": {
            "query": ">end",
            "fields": [
              "title"
            ]
          }
        }
      ]
    }
  }
}

RESULT: 3 hits (all docs) - wrong
EXPLAIN description: "ConstantScore(title:{end TO *]), product of:"

{
  "query": {

    "bool": {
      "should": [
        {
          "query_string": {
            "query": "<end",
            "fields": [
              "title"
            ]
          }
        }
      ]
    }
  }
}

RESULT: 3 hits (all docs) - wrong
EXPLAIN description: "ConstantScore(title:[* TO end}), product of:"

{
  "query": {

    "bool": {
      "should": [
        {
          "query_string": {
            "query": "end",
            "fields": [
              "title"
            ]
          }
        }
      ]
    }
  }
}

RESULT: 0 hits (correct!)

I tried to escape "<" and ">" in the query, but no success

Search for < and > in the elasticsearch and lucene docs - also no luck. 
Obvoiusly they are recognized as range operators, but I want to use them 
also as normal text symbols.
Is there any way to escape them properly ?


-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/6388d7d4-d14a-4e6e-b09b-67860ccbb574%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to