# How to define tags and ignore\_failure on Java API Client PutPipelineRequest

**URL:** https://discuss.elastic.co/t/how-to-define-tags-and-ignore-failure-on-java-api-client-putpipelinerequest/351292
**Category:** Elasticsearch
**Tags:** language-clients, ingest-pipeline
**Created:** [January 17, 2024, 3:40pm UTC](https://discuss.elastic.co/t/how-to-define-tags-and-ignore-failure-on-java-api-client-putpipelinerequest/351292 "2024-01-17T15:40:10Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![afzm4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/afzm4/32/130729_2.png) [@afzm4](https://discuss.elastic.co/u/afzm4)
#### Post date: [January 17, 2024, 3:40pm UTC](https://discuss.elastic.co/t/how-to-define-tags-and-ignore-failure-on-java-api-client-putpipelinerequest/351292/1 "2024-01-17T15:40:10Z")

</div>

We are in the process of upgrading to the new Java API client and are running into some problems regarding using PutPipelineRequest. This is how we're defining a PutPipelineRequest:

```auto
PutPipelineRequest putPipelineRequest = new PutPipelineRequest.Builder()
               .id(pipelineName)
               .withJson(new StringReader(pipelineDefinition))
               .build();

```

With the an example `pipelineDefinition` of something like this:

```auto
{
  "description": "extracts the birthday month from the birth_date",
  "processors": [
   {
      "script": {
        "lang": "painless",
        "source": "example script here",
        "tag": "birth_month",
        "ignore_failure": true
      }
    }
  ]
}

```

We are finding that while this works when we exclude `tag` and `ignore_failure` from the request, it fails due to a deserialization error like the following when we include it in the script processor like above:

```auto
co.elastic.clients.json.JsonpMappingException: Error deserializing co.elastic.clients.elasticsearch._types.InlineScript: Unknown field 'tag' (JSON path: processors[0].script.tag) (line no=1, column no=681, offset=680)

```

Is there something we're missing here/doing incorrectly? Or is it possible that the new Java API Client doesn't support setting those fields? According to [this](https://www.elastic.co/guide/en/elasticsearch/reference/current/script-processor.html) documentation, its appears as though they should be able to be defined in the script processor definition. Any help would be appreciated. Thanks!

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [January 17, 2024, 4:10pm UTC](https://discuss.elastic.co/t/how-to-define-tags-and-ignore-failure-on-java-api-client-putpipelinerequest/351292/2 "2024-01-17T16:10:51Z")

</div>

Welcome!

I agree. The ScriptProcessor builder seems to be missing some options.

For example, `ignore_failure` can not be set:

```auto
client.ingest().putPipeline(pr -> pr
        .id("my-pipeline")
        .processors(p -> p
            .script(s -> s
                    .inline(is -> is
                            .source("ctx.foo = 'bar'")
                            .lang("painless"))
                            // This is not available
                            .ignoreFailure(true)
            )
        )
);

```

But it can with other processors like the `set` processor.

```auto
client.ingest().putPipeline(pr -> pr
        .id("my-pipeline")
        .processors(p -> p
            .set(s -> s
                    .field("foo")
                    .value(JsonData.of("bar"))
                    // This is available
                    .ignoreFailure(true)
            )
        )
);

```

I can see that there's an opened issue about this:

> <https://github.com/elastic/elasticsearch-java/issues/500>
>
> \### Java API client version
> 
> 7.17.8
> 
> \### Java version
> 
> 11
> 
> \### Elasticsearch Ver…sion
> 
> 7.17.8
> 
> \### Problem description
> 
> I coded using ProcessorBuilders.script().
> 
> However, I noticed that ProcessorBuilders.script() does not support most of the parameters available in Script Processor as described in the Ingest processor reference documentation.
> https://www.elastic.co/guide/en/elasticsearch/reference/7.17/script-processor.html
> 
> Is there any way to work around this problem?
> 
> \`\`\`java
> return ProcessorBuilders.script(b -\> b
> .inline(i -\> i
> .lang(map.getLang())
> .source(map.getSource())
> .params(params)));
> \`\`\`

---

<div class="post-metadata">

### Author: ![afzm4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/afzm4/32/130729_2.png) [@afzm4](https://discuss.elastic.co/u/afzm4)
#### Post date: [January 17, 2024, 6:23pm UTC](https://discuss.elastic.co/t/how-to-define-tags-and-ignore-failure-on-java-api-client-putpipelinerequest/351292/3 "2024-01-17T18:23:55Z")

</div>

Ah okay. Glad to know it wasn't something I was missing. I should be able to work around the missing functionality for now by updating those fields directly in the kibana stack management tool. But definitely something that would be useful to define within the inline script processor when building it in the Java API.

---

<div class="post-metadata">

### Author: ![ltrotta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ltrotta/32/124003_2.png) [@ltrotta](https://discuss.elastic.co/u/ltrotta)
#### Post date: [January 24, 2024, 5:21pm UTC](https://discuss.elastic.co/t/how-to-define-tags-and-ignore-failure-on-java-api-client-putpipelinerequest/351292/4 "2024-01-24T17:21:54Z")

</div>

Hey! Thank you for reporting this issue, we're currently working on it and it will be fixed soon 🙂

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [February 21, 2024, 5:22pm UTC](https://discuss.elastic.co/t/how-to-define-tags-and-ignore-failure-on-java-api-client-putpipelinerequest/351292/5 "2024-02-21T17:22:38Z")

</div>

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