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

243
Vistas
How to aggregate combinations / permutations in elasticsearch

Is there a possibility to aggregate combinations or permutations in elasticsearch of a single field per document?

Example for combinations for 1 row:

keyword_field : ["test", "array", "for", "combinations"]

<-- aggregate -->

[
  [ 'test', 'array' ],
  [ 'test', 'for' ],
  [ 'test', 'combinations' ],
  [ 'array', 'for' ],
  [ 'array', 'combinations' ],
  [ 'for', 'combinations' ]
]

I want to calculate how often words appear together in a document. Therefore I imagine that I need to calculate combinations independend for every single document and later add them together.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You'll need to create a new column with painless script to achieve this.

The script would work per document, but you can aggregate on the resulting column and get the stats you need.

So, you'll need to:

  • use the update_by_query API to update the existing documents with the new columns
  • Or, you could route your incomming documents through an ingest pipeline with the painless code that does this
  • Or, if you'd like to do this for existing and all incomming documents, then you'll need all of above

Note that a scripted field is not going to work, as it does not work with aggregates (last I checked)...

about 4 years ago · Juan Pablo Isaza 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