If I use transport client for elasticsearch, when indexing a document to a non-existing index, it will automatically generate the new index and figure out the mapping from the first document. Please correct me if I got it wrong.
So my question is, do we still need to set up an index manually using XPUT? Is there any advantage of doing this?
But is it true that it's actually the mapping that really matters in terms of opting for manual setting? In other word, only putting an index doesn't help at all, since dynamic template can easily figure out the index name but mapping is more complicated. If the first document is malformed, then the mapping could be problematic.
And would it cause any problem when indexing a document that doesn't match the preset mapping? In the sense that control index setting and mapping is more reliable and prevent unmapping documents?
Other than where documented, existing type and field mappings cannot be updated. Changing the mapping would mean invalidating already indexed documents. Instead, you should create a new index with the correct mappings and reindex your data into that index.
So are you saying that if a document has more fields than the mapping, it would upgrading the mapping by adding the new fields? But the existing documents don't have such fields. Would it be a problem?
Also, how about a document has a field that doesn't match the type defined in the mapping? For instance, I have a field called "day" in mapping defined as a number , but I index a document with a field called "day" that is a string?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.