mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 17:34:17 -04:00
LLClient: Add setJsonEntity (#30447)
Adds `Request#setJsonEntity(String)` which short circuits the process of sending a json string which is super common.
This commit is contained in:
parent
9828e11709
commit
b4502dbf74
6 changed files with 52 additions and 11 deletions
|
@ -263,6 +263,14 @@ IMPORTANT: The `ContentType` specified for the `HttpEntity` is important
|
|||
because it will be used to set the `Content-Type` header so that Elasticsearch
|
||||
can properly parse the content.
|
||||
|
||||
You can also set it to a `String` which will default to
|
||||
a `ContentType` of `application/json`.
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/RestClientDocumentation.java[rest-client-body-shorter]
|
||||
--------------------------------------------------
|
||||
|
||||
And you can set a list of headers to send with the request:
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue