Hello,
I have a large index with very specific field mapping that would not be easy to change. We have an application the requires specific field names for the data it uses. For example our main index has a field "feature.name" and the application needs to use a field called "title" that would map to the value of "feature.name" in the original index.
I'm familiar with creating alias fields to reference other fields within the same index, however the required field names may change or may conflict in the future.
Is it possible to create a new index that merely acts as an alias for the original index, so that the new index could have the exact field names needed and just map to the fields in the original index?
Example:
Primary-Index (main index with all our data)
feature: { name: text }
New-Alias-Index (index that only points to fields in the Primary-Index)
So far I've come up with using a search template that includes all of the field mappings via scripted_fields, but I worry about the long term impact of this approach on scalability.
No, Elasticsearch does not directly support creating an index alias that remaps fields from one name to another. However, you can achieve similar results by using Elasticsearch's ingest pipelines to rename fields during ingestion, reindexing data with a script to change field names, handling the mapping at the application level, or developing custom middleware to translate field names in queries and responses. Each approach has its own trade-offs and complexities.
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.