于鹏飞
于鹏飞

Reputation: 13

how to make ElasticSearch treat keyword as string not date

I set the mapping of some properties to have keyword type, most of them are interpret as string, but if a property looks like "2016-03-23", it is treat as a date, which is not what I want. After whole day on google, I did not find a solution.

Upvotes: 1

Views: 542

Answers (1)

Val
Val

Reputation: 217584

You need to disable date detection. When creating your index/mapping, just make sure to specify it since it's enabled by default:

PUT my_index
{
  "mappings": {
    "my_type": {
      "date_detection": false         <--- add this
    }
  }
}

Upvotes: 1

Related Questions