Term query with keyword mapping

Hi,

a very simple mappping:

    {
   "mappings": {
    "chat": {
      "properties": {
        "checksum": {
          "type": "keyword"
        },
        "created": {
          "type": "date",
          "store": true,
          "format": "YYYY-MM-dd HH:mm:ss"
        },
        "archived": {
          "type": "boolean"
        }
      }
    }
  }
}

and an even more simple query:

    'query' => [
                'term' => [
                    'checksum' =>  'somevalue'
                ]
            ]

this is almost an exact copy out of the examples :slight_smile: and still it does not give me any results. When i request the field mapping it does give me the keyword mapping on the checksum field.

I have looked into the index to see which documents are indexed and 'somevalue' really does exist. 'somevalue' obviously does not represent the real value, that would be a md5 string. but it should'nt matter right? The field is not analyzed and term query should go for to exact matc.

What am i doing wrong here?

Already found the issue, when indexing a "doc" was indexed which caused the actual document the be one layer deeper. Works as expected now :slight_smile:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.