Skip to content

Commit 8141b56

Browse files
committed
[DOCS] Adds curl explanation to getting started content (#51963)
1 parent c1827fb commit 8141b56

File tree

1 file changed

+40
-3
lines changed

1 file changed

+40
-3
lines changed

docs/reference/getting-started.asciidoc

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,7 @@ The cat APIs return information about your cluster and indices in a
156156
format that's easier to read than raw JSON.
157157
+
158158
You can interact directly with your cluster by submitting HTTP requests to
159-
the {es} REST API. Most of the examples in this guide enable you to copy the
160-
appropriate cURL command and submit the request to your local {es} instance from
161-
the command line. If you have Kibana installed and running, you can also
159+
the {es} REST API. If you have Kibana installed and running, you can also
162160
open Kibana and submit requests through the Dev Console.
163161
+
164162
TIP: You'll want to check out the
@@ -189,6 +187,45 @@ cannot be replicated to another node to provide resiliency. Replica shards must
189187
be available for the cluster status to be green. If the cluster status is red,
190188
some data is unavailable.
191189

190+
[discrete]
191+
[[gs-curl]]
192+
=== Talking to {es} with cURL commands
193+
194+
Most of the examples in this guide enable you to copy the appropriate cURL
195+
command and submit the request to your local {es} instance from the command line.
196+
197+
A request to Elasticsearch consists of the same parts as any HTTP request:
198+
199+
[source,sh]
200+
--------------------------------------------------
201+
curl -X<VERB> '<PROTOCOL>://<HOST>:<PORT>/<PATH>?<QUERY_STRING>' -d '<BODY>'
202+
--------------------------------------------------
203+
// NOTCONSOLE
204+
205+
This example uses the following variables:
206+
207+
`<VERB>`:: The appropriate HTTP method or verb. For example, `GET`, `POST`,
208+
`PUT`, `HEAD`, or `DELETE`.
209+
`<PROTOCOL>`:: Either `http` or `https`. Use the latter if you have an HTTPS
210+
proxy in front of {es} or you use {es} {security-features} to encrypt HTTP
211+
communications.
212+
`<HOST>`:: The hostname of any node in your {es} cluster. Alternatively, use
213+
+localhost+ for a node on your local machine.
214+
`<PORT>`:: The port running the {es} HTTP service, which defaults to `9200`.
215+
`<PATH>`:: The API endpoint, which can contain multiple components, such as
216+
`_cluster/stats` or `_nodes/stats/jvm`.
217+
`<QUERY_STRING>`:: Any optional query-string parameters. For example, `?pretty`
218+
will _pretty-print_ the JSON response to make it easier to read.
219+
`<BODY>`:: A JSON-encoded request body (if necessary).
220+
221+
If the {es} {security-features} are enabled, you must also provide a valid user
222+
name (and password) that has authority to run the API. For example, use the
223+
`-u` or `--u` cURL command parameter. For details about which security
224+
privileges are required to run each API, see <<rest-apis>>.
225+
226+
{es} responds to each API request with an HTTP status code like `200 OK`. With
227+
the exception of `HEAD` requests, it also returns a JSON-encoded response body.
228+
192229
[float]
193230
[[gs-other-install]]
194231
=== Other installation options

0 commit comments

Comments
 (0)