Create a field base on other docs results in the same index

Hi,
I'm using scripted fields and I've see that it's applied on docs index one after an other.
I need to combine field value of the current field with an other doc's field in the same index.
So is it possible to query a doc field value that is somewhere in my index in the painless scripted field ?

Thank you

You can't do that with scripted fields, mostly for performance reasons.

Instead, it is recommended to do these things before the documents get indexed in Elasticsearch.

It's possible to do this in your own application (before ingesting, doing a request to Elasticsearch and basically moving the script into your application).

However it makes sense to solve it within the Elastic stack. You can use an ingest pipeline with an enrich processor - use it to look up the fields you need and put them into your document - then you can use a script processor to execute your script based on the data pulled in from other documents.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.