How to stop text field to be 'keyword' in dynamic mapping

running the below piece of code :

PUT /data/row/1
{
"name":"vijay"
}

creates the index where "name" field is of type "text" and "keyword" both :

{
   "data": {
      "mappings": {
         "row": {
            "properties": {
               "name": {
                  "type": "text",  <--------
                  "fields": {
                     "keyword": {
                        "type": "keyword",  <--------
                        "ignore_above": 256
                     }
                  }
               }
            }
         }
      }
   }
}

How can I stop this behaviour of text field to automatically becoming keyword, using the same above code (1st)

The easiest way is to provide your mapping for this field instead of letting elasticsearch autoguessing.
Then you can also define a dynamic template which will be applied to all String fields.

1 Like

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