Hi!

I'm using ElasticSearch 1.2.1 and have an index with documents of the type 
html-widget. These documents can have (among other things) the property 
contentForMobile. I want to list all html-widget documents without the 
field contentForMobile. I use this query:

curl -XPOST 'http://my-elastic-host:9200/the-index/html-widget/_search' -d 
'{
  "query": {
    "filtered": {
      "filter": {
        "bool": {
          "must": [
            {
              "missing": {
                "field": "contentForMobile"
              }
            }
          ]
        }
      }
    }
  }
}'

But this query returns results that do have contentForMobile set (and I'm 
not talking about null/empty strings but proper string values). I've also 
tried using the query:

{
  "query": {
    "constant_score": {
      "filter": {
        "missing": {
          "field": "contentForMobile"
        }
      }
    }
  }
}

With the same result. The field contentForMobile is mapped like this:

{
  "type": "string",
  "analyzer": "string_untouched",
  "fields": {
    "analyzed": {
      "type": "string",
      "analyzer": "standard"
    },
    "lower": {
      "type": "string",
      "analyzer": "string_lowercase"
    },
    "swedish": {
      "type": "string",
      "analyzer": "swedish"
    },
    "sort": {
      "type": "string",
      "analyzer": "string_sort"
    }
  }
}

I've also tried the exists filter and I can see that there is a difference 
in the result:

Total number of html-widget documents: 434
Documents missing contentForMobile: 165
Documents where contentForMobile exists: 269

All documents returned with the exists query does have the property set but 
most documents returned with the missing query also have the property set...

What have I not thought of?

Best regards,
Gabriel Falkenberg

-- 
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/064893ae-784d-4b9e-a5a9-838be7480b49%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to