Curl Cheat Sheet



Curl HTTP cheat sheet refresh. This message: Message body More options Related messages: Next message Previous message From: Daniel Stenberg via curl.

  1. Curl Pdf
  2. Curl Cheat Sheet
  3. Curl Command Cheat Sheet Pdf

Here we show some of the most common ElasticSearch commands using curl. ElasticSearch is sometimes complicated. So here we make it simple.

CheatCheat

(This article is part of our ElasticSearch Guide. Use the right-hand menu to navigate.)

delete index

Below the index is named samples.

list all indexes

CURL Cheat Sheet Curl is the swiss army knife for gathering information while troubleshooting websites. There are many ways to use curl and this guide is simply documenting the ones I often use, but can never seem to remember the specific flags. Title: cURL cheat sheet Cheat Sheet by deleted - Cheatography.com Created Date: 0024Z. Curl is an awesome tool. I keep forgetting the switches though, so here's a cheatsheet. Simple GET request.

Curl Cheat Sheet

list all docs in index

query using URL parameters

Here we use Lucene query format to write q=school:Harvard.

Query with JSON aka Elasticsearch Query DSL

You can query using parameters on the URL. But you can also use JSON, as shown in the next example. JSON would be easier to read and debug when you have a complex query than one giant string of URL parameters.

list index mapping

All Elasticsearch fields are indexes. So this lists all fields and their types in an index.

Add Data

Update Doc

Here is how to add fields to an existing document. First we create a new one. Then we update it.

Curl command cheat sheet

backup index

Bulk load data in JSON format

Show cluster health

Aggregation and Bucket Aggregation

Curl Pdf

For an nginx web server this produces web hit counts by user city:

This expands that to product response code count by city in an nginx web server log

Using ElasticSearch with Basic Authentication

If you have turned on security with ElasticSearch then you need to supply the user and password like shown below to every curl command:

Pretty Print

Add ?pretty=true to any search to pretty print the JSON. Like this:

To query and return only certain fields

Curl Cheat Sheet

To return only certain fields put them into the _source array:

To Query by Date

Curl Cheat Sheet

Curl Command Cheat Sheet Pdf

When the field is of type date you can use date math, like this: