POST adding new keys

Hi all,

I'm writing a service where other services can CRUD ElasticSearch. I'm have a schema that I stick to it to create POST body. I'm testing the service with Postman and I notice something unexpected. Just for giggles, I added a new kew: value that was never included in a POST body. I noticed that I got a 200 on Postman. I opened Kibana and looked at /_mapping and the new key: value was there with types.

My question is how dynamic is ElasticSearch in that regard? Should I implement validation at the application layer? Is there a flag I can turn on in ES to avoid dynamic POST.

I kind of like the freedom of adding a new field and allow ES infer the type without DELETE the index and moving the data to a new index with the new mappings.

  1. I created my dev index by creating a JSON file with 1K docs. I didn't create mappings first but rather did a bulk POST and let ES auto-create the mappings.
  2. I'm using ES 7.8

Thoughts about my assumptions?

Thanks

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