Created
October 19, 2020 14:42
-
-
Save nik9000/1500f8896b30db104ec0f113f85a627a to your computer and use it in GitHub Desktop.
demo2.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Demo part 2 | |
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-20T13:30:00Z", "track": "Databases", "title": "Why Postgres" } | |
' | |
curl -uelastic:password -HContent-Type:application/json -XPOST 'localhost:9200/test/_search?pretty' -d'{ | |
"query": { | |
"match": { | |
"track": "databases" | |
} | |
} | |
}' | |
curl -uelastic:password -HContent-Type:application/json -XPOST 'localhost:9200/test/_search?pretty' -d'{ | |
"aggs": { | |
"tracks": { | |
"terms": { | |
"field": "track.keyword" | |
} | |
} | |
} | |
}' | |
curl -uelastic:password -HContent-Type:application/json -XPOST 'localhost:9200/test/_search?pretty' -d'{ | |
"aggs": { | |
"times": { | |
"date_histogram": { | |
"field": "timestamp", | |
"calendar_interval": "day" | |
} | |
} | |
} | |
}' | |
curl -uelastic:password -HContent-Type:application/json -XPOST 'localhost:9200/test/_search?pretty' -d'{ | |
"aggs": { | |
"tracks": { | |
"terms": { | |
"field": "track.keyword" | |
}, | |
"aggs": { | |
"times": { | |
"date_histogram": { | |
"field": "timestamp", | |
"calendar_interval": "day" | |
} | |
} | |
} | |
} | |
} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment