Data ignores datatype!

I am trying to insert data to ES using logstash template. Data is inserting fine but I have an issue with the data type. I have set datatype date for a particular data (in example reviewId), but it is also letting insert string datatype. I want to restrict this kind of insertion.

here is my template

  "index_patterns": ["my_index_*"],
  "settings": {
    "index": {
      "number_of_shards": "2",
      "number_of_replicas": "1"
  "mappings": {
      "dynamic": "false",
      "properties": {
        "reviewId": {
          "type": "date"
  "aliases": {}

my data

{"reviewId":"hello i am string","reviewer":{"profilePhotoUrl":bla bla","displayName":"Afrid Khan"},"starRating":"FIVE","comment":"Good working environment","createTime":"2018-11-21T11:38:54.366207Z","updateTime":"2018-11-21T11:39:11.527644Z","name":"bla bla"}

field reviewId is set to be a date type, but it is still inserting into ES.

Not only for a date, but I also want to restrict insertion if data does not match with correspondent type. How to prevent that ?

Thanks n Regards

Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

ooops!!! my mistake @dadoonet , thanks for your suggestion. I will update my post.

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