# Java client put logstash pipeline last\_modified error

**URL:** <https://discuss.elastic.co/t/java-client-put-logstash-pipeline-last-modified-error/313425>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [September 1, 2022, 9:22am UTC](https://discuss.elastic.co/t/java-client-put-logstash-pipeline-last-modified-error/313425 "2022-09-01T09:22:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alain\_Bod](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alain_bod/32/77345_2.png) [@Alain\_Bod](https://discuss.elastic.co/u/Alain_Bod)\
**Post date:** [September 1, 2022, 9:22am UTC](https://discuss.elastic.co/t/java-client-put-logstash-pipeline-last-modified-error/313425/1 "2022-09-01T09:22:23Z")

</div>

Hi,  
I'm using the new Java elasticsearch client to PUT a logstash pipeline (client version 8.4.1, server 8.4.1)

```auto
client.logstash().putPipeline(b -> b
                        .id(id)
                        .pipeline(p -> p
                                .description(id)
                                .lastModified(DateTime.ofEpochMilli(System.currentTimeMillis()))
                                .pipeline("input {}\n filter { grok {} }\n output {}")
                                .username("elastic")
                                .pipelineMetadata(m -> m
                                        .type("logstash_pipeline")
                                        .version("1")
                                )
                                .pipelineSettings(s -> s
                                        .pipelineBatchDelay(50)
                                        .pipelineBatchSize(125)
                                        .pipelineWorkers(1)
                                        .queueCheckpointWrites(1024)
                                        .queueMaxBytesNumber(1)
                                        .queueMaxBytesUnits("gb")
                                        .queueType("memory")
                                )
                        )
                )

```

Bu I get an error on the `last_modified` field:

```auto
DEBUG [2022-09-01 09:24:40,766] org.apache.http.wire: http-outgoing-1 >> "PUT /_logstash/pipeline/org_dataset HTTP/1.1[\r][\n]"
DEBUG [2022-09-01 09:24:40,766] org.apache.http.wire: http-outgoing-1 >> "X-Elastic-Client-Meta: es=8.4.1,jv=17,hl=2,t=8.4.1,hc=4.1.5[\r][\n]"
DEBUG [2022-09-01 09:24:40,766] org.apache.http.wire: http-outgoing-1 >> "User-Agent: elastic-java/8.4.1 (Java/17.0.4)[\r][\n]"
DEBUG [2022-09-01 09:24:40,766] org.apache.http.wire: http-outgoing-1 >> "Accept: application/vnd.elasticsearch+json; compatible-with=8[\r][\n]"
DEBUG [2022-09-01 09:24:40,766] org.apache.http.wire: http-outgoing-1 >> "Content-Length: 1593[\r][\n]"
DEBUG [2022-09-01 09:24:40,766] org.apache.http.wire: http-outgoing-1 >> "Content-Type: application/vnd.elasticsearch+json; compatible-with=8[\r][\n]"
DEBUG [2022-09-01 09:24:40,766] org.apache.http.wire: http-outgoing-1 >> "Host: xxxxxx:9243[\r][\n]"
DEBUG [2022-09-01 09:24:40,766] org.apache.http.wire: http-outgoing-1 >> "Connection: Keep-Alive[\r][\n]"
DEBUG [2022-09-01 09:24:40,766] org.apache.http.wire: http-outgoing-1 >> "Authorization: Basic xxxxxxx[\r][\n]"
DEBUG [2022-09-01 09:24:40,766] org.apache.http.wire: http-outgoing-1 >> "[\r][\n]"
DEBUG [2022-09-01 09:24:40,766] org.apache.http.wire: http-outgoing-1 >> "{"description":"org_dataset","last_modified":1662024280651,"pipeline_metadata":{"type":"logstash_pipeline",
[...]

DEBUG [2022-09-01 09:15:08,399] org.apache.http.wire: http-outgoing-1 << "HTTP/1.1 400 Bad Request[\r][\n]"
DEBUG [2022-09-01 09:15:08,399] org.apache.http.wire: http-outgoing-1 << "Content-Length: 287[\r][\n]"
DEBUG [2022-09-01 09:15:08,399] org.apache.http.wire: http-outgoing-1 << "Content-Type: application/json;charset=utf-8[\r][\n]"
DEBUG [2022-09-01 09:15:08,399] org.apache.http.wire: http-outgoing-1 << "X-Cloud-Request-Id: xxxxxxxxx[\r][\n]"
DEBUG [2022-09-01 09:15:08,399] org.apache.http.wire: http-outgoing-1 << "X-Elastic-Product: Elasticsearch[\r][\n]"
DEBUG [2022-09-01 09:15:08,399] org.apache.http.wire: http-outgoing-1 << "X-Found-Handling-Cluster: xxxxxxxxxx[\r][\n]"
DEBUG [2022-09-01 09:15:08,399] org.apache.http.wire: http-outgoing-1 << "X-Found-Handling-Instance: instance-0000000000[\r][\n]"
DEBUG [2022-09-01 09:15:08,399] org.apache.http.wire: http-outgoing-1 << "Date: Thu, 01 Sep 2022 09:15:08 GMT[\r][\n]"
DEBUG [2022-09-01 09:15:08,399] org.apache.http.wire: http-outgoing-1 << "[\r][\n]"
DEBUG [2022-09-01 09:15:08,399] org.apache.http.wire: http-outgoing-1 << "{"error":{"root_cause":[{"type":"x_content_parse_exception","reason":"[1:46] [pipeline] last_modified doesn't support values of type: VALUE_NUMBER"}],"type":"x_content_parse_exception","reason":"[1:46] [pipeline] last_modified doesn't support values of type: VALUE_NUMBER"},"status":400}"

```

Am I doing something wrong or is it a bug?

Cheers,

---

<div class="post-metadata">

**Author:** ![Alain\_Bod](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alain_bod/32/77345_2.png) [@Alain\_Bod](https://discuss.elastic.co/u/Alain_Bod)\
**Post date:** [September 8, 2022, 3:32pm UTC](https://discuss.elastic.co/t/java-client-put-logstash-pipeline-last-modified-error/313425/2 "2022-09-08T15:32:23Z")

</div>

@swallez maybe?

---

<div class="post-metadata">

**Author:** ![Alain\_Bod](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alain_bod/32/77345_2.png) [@Alain\_Bod](https://discuss.elastic.co/u/Alain_Bod)\
**Post date:** [October 3, 2022, 3:34pm UTC](https://discuss.elastic.co/t/java-client-put-logstash-pipeline-last-modified-error/313425/3 "2022-10-03T15:34:01Z")

</div>

nobody?

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [October 3, 2022, 3:47pm UTC](https://discuss.elastic.co/t/java-client-put-logstash-pipeline-last-modified-error/313425/4 "2022-10-03T15:47:28Z")

</div>

Check the [documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/logstash-api-put-pipeline.html#logstash-api-put-pipeline-request-body).

> `last_modified`  
> (Required, string) Date the pipeline was last updated. Must be in the `yyyy-MM-dd'T'HH:mm:ss.SSSZZ` [`strict_date_time`](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html) format.

The value for the `last_modified` needs to be in this format: `yyyy-MM-dd'T'HH:mm:ss.SSSZZ`

But from your log you are sending it as a number, with the date in epoch time.

> "{"description":"org\_dataset"," **last\_modified**": **1662024280651**

---

<div class="post-metadata">

**Author:** ![Alain\_Bod](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alain_bod/32/77345_2.png) [@Alain\_Bod](https://discuss.elastic.co/u/Alain_Bod)\
**Post date:** [October 3, 2022, 4:09pm UTC](https://discuss.elastic.co/t/java-client-put-logstash-pipeline-last-modified-error/313425/5 "2022-10-03T16:09:37Z")

</div>

> [@Alain\_Bod](#):
>
> ```auto
> .lastModified(DateTime.ofEpochMilli(System.currentTimeMillis()))
> 
> ```

As you can see, I'm sending it as a DateTime object which is what is required by the `lastModified(DateTime value)` method of the java client.

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [October 3, 2022, 8:39pm UTC](https://discuss.elastic.co/t/java-client-put-logstash-pipeline-last-modified-error/313425/6 "2022-10-03T20:39:33Z")

</div>

This is not what your log shows, the Debug line of your request shows that the `last_modified` is a number.

> DEBUG [2022-09-01 09:24:40,766] org.apache.http.wire: http-outgoing-1 \>\> "{"description":"org\_dataset","last\_modified": **1662024280651**

Maybe this is a bug then? You should open an issue to see if someone can help you better, but have you tried to format the date to see if it works?

---

<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:** [October 31, 2022, 8:40pm UTC](https://discuss.elastic.co/t/java-client-put-logstash-pipeline-last-modified-error/313425/7 "2022-10-31T20:40:31Z")

</div>

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