Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] add processors: set: copy_from #4672

Open
anubisg1 opened this issue Oct 4, 2022 · 6 comments
Open

[FEATURE] add processors: set: copy_from #4672

anubisg1 opened this issue Oct 4, 2022 · 6 comments
Labels
enhancement Enhancement or improvement to existing feature or request Indexing & Search Priority-Low

Comments

@anubisg1
Copy link

anubisg1 commented Oct 4, 2022

Describe the bug
With Elasticsearch 7.11 (i.e. the version immediately after OpenSearch fork), "copy_from" option for the "set" processor has been introduced, here - https://www.elastic.co/guide/en/elasticsearch/reference/7.11/set-processor.html

this breaks a lot of pipelines, registering pipelines will throw the following error:

Exiting: 1 error: error loading pipeline for fileset system/auth: couldn't load pipeline: couldn't load json. Error: 400 Bad Request: {"error":{"root_cause":[{"type":"parse_exception","reason":"[value] required property is missing","processor_type":"set","property_name":"value"}],"type":"parse_exception","reason":"[value] required property is missing","processor_type":"set","property_name":"value"},"status":400}. Response body: {"error":{"root_cause":[{"type":"parse_exception","reason":"[value] required property is missing","processor_type":"set","property_name":"value"}],"type":"parse_exception","reason":"[value] required property is missing","processor_type":"set","property_name":"value"},"status":400}

a workaround is available and requires to change

processors:
  - set:
      field: myfiled
      copy_from: myvalue

to

processors:
- set:
    field: myfiled
    value: '{{myvalue}}'
@anubisg1 anubisg1 added bug Something isn't working untriaged labels Oct 4, 2022
@anubisg1 anubisg1 changed the title [BUG] processors:set.copy_from: isn't understood breaking pipelines [BUG] processors: set: copy_from: isn't understood breaking pipelines Oct 4, 2022
@dblock
Copy link
Member

dblock commented Oct 5, 2022

Are you suggesting we implement copy_from in OpenSearch? Is this a bug in OpenSearch?

Please feel free to contribute an implementation without looking at/copying any code from Elasticseach.

@anubisg1
Copy link
Author

anubisg1 commented Oct 5, 2022

i am asking to implement something that allows compatibility with pipelines created for elasticsearch 7.11 and newer and use copy_from

i'm not asking to copy their implementation of that field .

happy to help in any way, but i am not a software developer unfortunately so i wouldn't know where to start

@dblock dblock changed the title [BUG] processors: set: copy_from: isn't understood breaking pipelines [FEATURE] add processors: set: copy_from Oct 5, 2022
@anasalkouz anasalkouz added enhancement Enhancement or improvement to existing feature or request Priority-Low and removed bug Something isn't working untriaged labels Oct 11, 2022
@fbarbeira
Copy link

I arrived here searching how to properly rename a field on a ingest pipeline using ingest processors.

Previously on Elasticsearch I used to apply rename processor but it seems like it is not available on Opensearch. Then I tried to find another approach and landed here. Does it exist a supported "out of the box" solution to rename a field on Opensearch?

Please tell me there is a better solution than this:

{
  "description": "Renames a field using a script",
  "processors": [
    {
      "script": {
        "source": """
          if (ctx.containsKey('old_field_name')) {
            ctx['new_field_name'] = ctx['old_field_name'];
            ctx.remove('old_field_name');
          }
        """
      }
    }
  ]
}

@fbarbeira
Copy link

OMG the dev tools suggest me to use "rename":

Captura de pantalla 2024-02-20 a las 12 47 34

I dit not even tried to use that because It does not appear on the official doc section.

It seems like it worked! :) maybe it should be added to the documentation?

@dblock
Copy link
Member

dblock commented Feb 28, 2024

If it's missing, please do at least open an issue in the doc repo (or just fix it!).

@fbarbeira
Copy link

It looks like a PR already exists

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement or improvement to existing feature or request Indexing & Search Priority-Low
Projects
Status: 🆕 New
Development

No branches or pull requests

5 participants