Skip to content

Instantly share code, notes, and snippets.

@wrobstory
Created June 20, 2016 23:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wrobstory/f11ee14d9cef3404bce786f98ac2022b to your computer and use it in GitHub Desktop.
Save wrobstory/f11ee14d9cef3404bce786f98ac2022b to your computer and use it in GitHub Desktop.
Elasticsearch Bug
curl -XPUT 'http://localhost:9200/test_index_1/dates/1?pretty' -d '{"when_received": "2016-04-25T13:21:24.000Z"}'
curl -XPUT 'http://localhost:9200/test_index_1/dates/2?pretty' -d '{"when_received": "2016-05-28T14:21:24.000Z"}'
curl -XPUT 'http://localhost:9200/test_index_1/dates/3?pretty' -d '{"when_received": "2016-06-28T17:21:24.000Z"}'
curl -XPUT 'http://localhost:9200/test_index_1/dates/4?pretty' -d '{"when_received": "2016-06-29T17:21:24.000Z"}'
curl -XPUT 'http://localhost:9200/test_index_2/dates/1?pretty' -d '{"when_recorded": "2016-04-25T13:21:24.000Z", "when_received": "2015-04-25T13:21:24.000Z"}'
curl -XPUT 'http://localhost:9200/test_index_2/dates/2?pretty' -d '{"when_recorded": "2016-05-28T14:21:24.000Z", "when_received": "2015-05-28T14:21:24.000Z"}'
curl -XPUT 'http://localhost:9200/test_index_2/dates/3?pretty' -d '{"when_recorded": "2016-06-28T17:21:24.000Z", "when_received": "2015-06-28T17:21:24.000Z"}'
curl -XPUT 'http://localhost:9200/test_index_2/dates/4?pretty' -d '{"when_recorded": "2016-06-29T17:21:24.000Z", "when_received": "2015-06-29T17:21:24.000Z"}'
curl -XPOST 'http://localhost:9200/test_index_1/_refresh'
curl -XPOST 'http://localhost:9200/test_index_2/_refresh'
curl -XPOST 'http://localhost:9200/_aliases' -d '
{
"actions" : [
{ "add" : { "index" : "test_index_1", "alias" : "all_indices" } },
{ "add" : { "index" : "test_index_2", "alias" : "all_indices" } }
]
}'
curl -XGET 'http://localhost:9200/all_indices/_search?pretty' -d '{
"size": 0,
"aggs":
{"monthly_date_histogram":
{"date_histogram": {"field": "when_recorded",
"interval": "month",
"min_doc_count": 0,
"extended_bounds": {"max": "now", "min": "now-5M"}}}}
}
'
curl -XGET 'http://localhost:9200/test_index_1/_search?pretty' -d '{
"size": 0,
"aggs":
{"monthly_date_histogram":
{"date_histogram": {"field": "when_recorded",
"interval": "month",
"min_doc_count": 0,
"extended_bounds": {"max": "now", "min": "now-5M"}}}}
}
'
curl -XGET 'http://localhost:9200/test_index_2/_search?pretty' -d '{
"size": 0,
"aggs":
{"monthly_date_histogram":
{"date_histogram": {"field": "when_recorded",
"interval": "month",
"min_doc_count": 0,
"extended_bounds": {"max": "now", "min": "now-5M"}}}}
}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment