5 ms·
> The values for field price in products mapping and the values for field price in promotions mapping (in the same index) will essentially be added to the same
by shubhamjain 11y ago
> The values for field price in products mapping and the values for field price in promotions mapping (in the same index) will essentially be added to the same list at Lucene Segment level. And it will not fail or throw an exception.
Probably a stupid question but why can't ElasticSearch translate both mappings into something like, "products_price", and "promotions_price" before adding to the 'list'?
- vaidik 11y agoSomething I wondered too. But I think in the 2.x versions, they are already planning something around it. Honestly, I have not looked at it much yet but even creating another mapping with the same field name but different type should perhaps throw a warning or not be allowed unless overridden as they lead to things like these.
- craigching 11y agoIn 2.x, all fields must adhere to the same data type or you will get a failure [1]. To quote: Fields with the same name, in the same index, in different types, must have the same mapping So hopefully this isn't an issue anymore! I do strongly suggest (and we've done this from the beginning) that no one rely on elasticsearch's auto mapping and that you should explicitly map your fields. [1] -- https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking_20_mapping_changes.html https://www.elastic.co/guide/en/elasticsearch/reference/curr...
- vaidik 11y agoYes you are right. In fact, a simple work around, before Elasticsearch coming out with this feature in their 2.x releases, was to review mappings and what goes in Elasticsearch. And we got careless about that and shot ourselves in the foot. We learned it the hard way.
- vaidik 11y agoAnd BTW, that is something that Elasticsearch recommends you to do that manually in the current versions as well. Read this: https://www.elastic.co/guide/en/elasticsearch/guide/current/mapping.html#_avoiding_type_gotchas https://www.elastic.co/guide/en/elasticsearch/guide/current/...