# Java client put logstash pipeline

**URL:** <https://discuss.elastic.co/t/java-client-put-logstash-pipeline/309345>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [July 11, 2022, 4:26pm UTC](https://discuss.elastic.co/t/java-client-put-logstash-pipeline/309345 "2022-07-11T16:26:35Z")\
**Posts on this page:** 3\
**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:** [July 11, 2022, 4:26pm UTC](https://discuss.elastic.co/t/java-client-put-logstash-pipeline/309345/1 "2022-07-11T16:26:35Z")

</div>

Hi,  
I'm using the new Java elasticsearch client to PUT a logstash pipeline.

```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")
                                )
                        )
                )

```

but I get back an error

```auto
DEBUG [2022-07-11 16:09:26,004] org.apache.http.wire: http-outgoing-0 >> "PUT /_logstash/pipeline/org_dataset HTTP/1.1[\r][\n]"
DEBUG [2022-07-11 16:09:26,004] org.apache.http.wire: http-outgoing-0 >> "User-Agent: elastic-java/8.3.2 (Java/17.0.3)[\r][\n]"
DEBUG [2022-07-11 16:09:26,004] org.apache.http.wire: http-outgoing-0 >> "X-Elastic-Client-Meta: es=8.3.2,jv=17,hl=2,t=8.3.2,hc=4.1.4[\r][\n]"
DEBUG [2022-07-11 16:09:26,004] org.apache.http.wire: http-outgoing-0 >> "Accept: application/vnd.elasticsearch+json; compatible-with=8[\r][\n]"
DEBUG [2022-07-11 16:09:26,004] org.apache.http.wire: http-outgoing-0 >> "Content-Length: 0[\r][\n]"
DEBUG [2022-07-11 16:09:26,004] org.apache.http.wire: http-outgoing-0 >> "Host: xxxxxxxxxx:9243[\r][\n]"
DEBUG [2022-07-11 16:09:26,004] org.apache.http.wire: http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
DEBUG [2022-07-11 16:09:26,004] org.apache.http.wire: http-outgoing-0 >> "Authorization: Basic xxxxxxxxxxxxx=[\r][\n]"
DEBUG [2022-07-11 16:09:26,004] org.apache.http.wire: http-outgoing-0 >> "[\r][\n]"
DEBUG [2022-07-11 16:09:26,004] org.apache.http.impl.nio.client.InternalIODispatch: http-outgoing-0 [ACTIVE] Request ready
DEBUG [2022-07-11 16:09:26,004] org.apache.http.impl.nio.conn.ManagedNHttpClientConnectionImpl: http-outgoing-0 192.168.0.14:59600<->xxxxx:9243[ACTIVE][r:w][ACTIVE][r][NOT_HANDSHAKING][0][0][0]: Event cleared [w]
DEBUG [2022-07-11 16:09:26,030] org.apache.http.impl.nio.conn.ManagedNHttpClientConnectionImpl: http-outgoing-0 192.168.0.14:59600<->xxxxxx:9243[ACTIVE][r:r][ACTIVE][r][NOT_HANDSHAKING][0][0][0]: 481 bytes read
DEBUG [2022-07-11 16:09:26,030] org.apache.http.wire: http-outgoing-0 << "HTTP/1.1 400 Bad Request[\r][\n]"
DEBUG [2022-07-11 16:09:26,030] org.apache.http.wire: http-outgoing-0 << "Content-Length: 163[\r][\n]"
DEBUG [2022-07-11 16:09:26,030] org.apache.http.wire: http-outgoing-0 << "Content-Type: application/json;charset=utf-8[\r][\n]"
DEBUG [2022-07-11 16:09:26,030] org.apache.http.wire: http-outgoing-0 << "X-Cloud-Request-Id: OYCV37idR6S5_nmgbwsOvg[\r][\n]"
DEBUG [2022-07-11 16:09:26,030] org.apache.http.wire: http-outgoing-0 << "X-Elastic-Product: Elasticsearch[\r][\n]"
DEBUG [2022-07-11 16:09:26,030] org.apache.http.wire: http-outgoing-0 << "X-Found-Handling-Cluster: xxxxxxx[\r][\n]"
DEBUG [2022-07-11 16:09:26,030] org.apache.http.wire: http-outgoing-0 << "X-Found-Handling-Instance: instance-0000000000[\r][\n]"
DEBUG [2022-07-11 16:09:26,030] org.apache.http.wire: http-outgoing-0 << "Date: Mon, 11 Jul 2022 16:09:26 GMT[\r][\n]"
DEBUG [2022-07-11 16:09:26,030] org.apache.http.wire: http-outgoing-0 << "[\r][\n]"
DEBUG [2022-07-11 16:09:26,030] org.apache.http.wire: http-outgoing-0 << "{"error":{"root_cause":[{"type":"parse_exception","reason":"request body is required"}],"type":"parse_exception","reason":"request body is required"},"status":400}"

```

What am I doing wrong?  
If I PUT directly via HTTP, it works, although losgstash 8.3.2 complains about:

```auto
[2022-07-11T16:19:05,941][WARN][logstash.configmanagement.elasticsearchsource] Ignoring unsupported or unknown pipeline settings 'queue.max_bytes.number'
[2022-07-11T16:19:05,941][WARN][logstash.configmanagement.elasticsearchsource] Ignoring unsupported or unknown pipeline settings 'queue.max_bytes.units'

```

---

<div class="post-metadata">

**Author:** ![swallez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/swallez/32/11972_2.png) [@swallez](https://discuss.elastic.co/u/swallez)\
**Post date:** [July 12, 2022, 10:29am UTC](https://discuss.elastic.co/t/java-client-put-logstash-pipeline/309345/2 "2022-07-12T10:29:04Z")

</div>

This is actually a bug. I just fixed it in [Boolean response endpoints can have a request body by swallez · Pull Request #341 · elastic/elasticsearch-java · GitHub](https://github.com/elastic/elasticsearch-java/pull/341)

Thanks for having found and reported this issue.

---

<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:** [August 9, 2022, 10:29am UTC](https://discuss.elastic.co/t/java-client-put-logstash-pipeline/309345/3 "2022-08-09T10:29:09Z")

</div>

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