Skip to content

Latest commit

 

History

History
36 lines (33 loc) · 667 Bytes

9a02bd47c000a3d9a8911233c37c890f.asciidoc

File metadata and controls

36 lines (33 loc) · 667 Bytes
resp = client.index(
    index="my-index-000001",
    id="1",
    refresh=True,
    body={"date": "2015-10-01T00:30:00Z"},
)
print(resp)

resp = client.index(
    index="my-index-000001",
    id="2",
    refresh=True,
    body={"date": "2015-10-01T01:30:00Z"},
)
print(resp)

resp = client.search(
    index="my-index-000001",
    size="0",
    body={
        "aggs": {
            "by_day": {
                "date_histogram": {
                    "field": "date",
                    "calendar_interval": "day",
                }
            }
        }
    },
)
print(resp)