Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

249
Vistas
How to rename field name in Elasticsearch with Time efficient?

I have been using the following query to rename fieldName.

POST http://localhost:9200/INDEX_NAME/_update_by_query
{
    "query": { 
        "exists": {
            "field": "NEW_FIELD_NAME"
        }
    },
    "script" : {
        "inline": "ctx._source.NEW_FIELD_NAME = ctx._source.OLD_FIELD_NAME; ctx._source.remove(\"OLD_FIELD_NAME\");"
    }
}

But for more than 4.2 million data. It takes about 2-3 minutes.

Is there any way to reduce the duration?

The ElasticSearch version is 5.6.4

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

David's answer on Discuss is the hard way. If you're looking for an easy way, and if your index has more than 1 primary shard, you can use slicing in order to parallelize the work:

POST http://localhost:9200/INDEX_NAME/_update_by_query?slices=auto&wait_for_completion=false
{
    ...
}

But David is right, you should upgrade at some point ;-)

over 4 years ago · Santiago Trujillo Denunciar

0

A totally different way to do this which ensures zero downtime is to first create a new index map with the updated field name.

After that, you can use the reindex API to populate data to this new index. https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html

Assuming you are using aliases, you can update the underlying index for this alias once re-indexing is finished. This will assure there is no downtime in the application using this data. Reindex API also supports various conf params to make the indexing process faster.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda