Script processor not adding a new field using ingest pipeline

I am trying to compare values with already data already indexed with some user input values
through script processor,
script is running successfully but its not creating a new field which actually stores the result.

		{
	  "script": {
    "source": """
      if (!ctx.containsKey('manager-list.keyword') || ctx['manager-list.keyword'].size() == 0) {
    return;
}
if (ctx.containsKey('manager-list.keyword')) {
def managerName = ctx['manager-list.keyword'].value;
      def givenValues = ['xyz@gmail.com', 'yyy@gmail.com'];
      
      for (String value : givenValues) {
        if (managerName == value) {
          ctx.result = value;
          break;
        }
      }
}
    """,
  "lang": "painless"
		}
	}

I want to store the output in a field so I guess result variable would be added as new field but it's not working.

After that I am running update_by_query to update the data. but no success
could you please check.

Could you please check why its not creating a new field 'result'

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