No results with term filter/query on unanalyzed field


(Vasco) #1

I have a non-analyzed field in my index. The field in question has mapping:

"ean" : { "index" : "not_analyzed", "type" : "string" }

I verified the mappig is working, i.e., the field isn't analyzed.

The record that is not being returned can be found by searching on another field. It seems that the value of the problematic field also isn't included in _all.

The query I issue is simple:

{'query': {'term': {'ean': '3660619000159'}}}

A filter like so:

{
  "query": {
    "filtered": {
      "filter": {
        "term": {
          "ean": "3660619000159"
        }
      },
      "query": {
        "match_all": {}
      }
    }
  }
}

Also doesn't retrieve anything. Am I missing something obvious? What can cause this behavior? How can I debug this?


(Adrien Grand) #2

Can you provide a full reproduction of the issue? Also which version of elasticsearch are you running and does your ean field happen to be mapped on other types as well?


(Vasco) #3

The inserted documents are the results of a web crawl. I can't reproduce the indexing sequence.

I am running ES 1.5.2

the mapping definition of the index is simple, mostly simple fields:

{ 
    "properties" : {
        "site" : { "index" : "not_analyzed", 
                     "type" : "string", 
                     "include_in_all": False },
        "ean" : { "index" : "not_analyzed", "type" : "string" },
        <...> more simple fields like ean <...>
    },
    "dynamic_templates": [
        { "data" : {
            "path_match" : "data*",
            "mapping": {
                "index" : "no",
                "store" : "no"
            }
        }}
    ]
}

(system) #4