Skip to content

Instantly share code, notes, and snippets.

@nik9000
Created October 19, 2020 14:41
Show Gist options
  • Save nik9000/7f1c8670dd84a008c97035c1d40b2a16 to your computer and use it in GitHub Desktop.
Save nik9000/7f1c8670dd84a008c97035c1d40b2a16 to your computer and use it in GitHub Desktop.
demo1.sh
Demo part 1
curl -uelastic:password -HContent-Type:application/json -XDELETE localhost:9200/test
curl -uelastic:password -HContent-Type:application/json -XPOST 'localhost:9200/test/_doc/es?refresh&pretty' -d'{
"timestamp": "2020-10-19T21:00:00Z",
"track": "Networking/Elasticsearch",
"title": "Contributing to Elasticsearch"
}'
curl -uelastic:password 'localhost:9200/test/_doc/es?pretty'
curl -uelastic:password -HContent-Type:application/json -XPOST 'localhost:9200/test/_search?pretty' -d'{
"query": {
"range": {
"timestamp": {
"gt": "2020-10-19T12:00:00Z"
}
}
}
}'
curl -uelastic:password -HContent-Type:application/json -XPOST 'localhost:9200/test/_search?pretty' -d'{
"query": {
"match": {
"title": "contributing"
}
}
}'
curl -uelastic:password -HContent-Type:application/json -XPOST 'localhost:9200/test/_bulk?refresh&pretty' -d'
{ "index": { "_id": "nginx" } }
{ "timestamp": "2020-10-19T14:00:00Z", "track": "Networking/Elasticsearch", "title": "A Reference Architecture for Running Modern APIs with NGINX Unit and NGINX Web Server" }
{ "index": { "_id": "nebula" } }
{ "timestamp": "2020-10-19T16:00:00Z", "track": "Networking/Elasticsearch", "title": "Creating a Fast, Secure, Location Agnostic Mesh Network with Nebula." }
{ "index": { "_id": "mysql" } }
{ "timestamp": "2020-10-19T14:00:00Z", "track": "Databases", "title": "MySQL Indexes, Histograms, Locking Options, and Other Ways to Speed Up Your Queries" }
{ "index": { "_id": "spark3" } }
{ "timestamp": "2020-10-19T14:00:00Z", "track": "Databases", "title": "Big Data made easy with a Spark (3.0)" }
{ "index": { "_id": "because_its_great" } }
{ "timestamp": "2020-10-21T13:30:00Z", "track": "Databases", "title": "Why Postgres" }
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment