// This file is autogenerated, DO NOT EDIT
// aggregations/metrics/geoline-aggregation.asciidoc:13

[source, python]
----
resp = client.indices.create(
    index="test",
    mappings={
        "properties": {
            "my_location": {
                "type": "geo_point"
            },
            "group": {
                "type": "keyword"
            },
            "@timestamp": {
                "type": "date"
            }
        }
    },
)
print(resp)

resp1 = client.bulk(
    index="test",
    refresh=True,
    operations=[
        {
            "index": {}
        },
        {
            "my_location": {
                "lat": 52.373184,
                "lon": 4.889187
            },
            "@timestamp": "2023-01-02T09:00:00Z"
        },
        {
            "index": {}
        },
        {
            "my_location": {
                "lat": 52.370159,
                "lon": 4.885057
            },
            "@timestamp": "2023-01-02T10:00:00Z"
        },
        {
            "index": {}
        },
        {
            "my_location": {
                "lat": 52.369219,
                "lon": 4.901618
            },
            "@timestamp": "2023-01-02T13:00:00Z"
        },
        {
            "index": {}
        },
        {
            "my_location": {
                "lat": 52.374081,
                "lon": 4.91235
            },
            "@timestamp": "2023-01-02T16:00:00Z"
        },
        {
            "index": {}
        },
        {
            "my_location": {
                "lat": 52.371667,
                "lon": 4.914722
            },
            "@timestamp": "2023-01-03T12:00:00Z"
        }
    ],
)
print(resp1)

resp2 = client.search(
    index="test",
    filter_path="aggregations",
    aggs={
        "line": {
            "geo_line": {
                "point": {
                    "field": "my_location"
                },
                "sort": {
                    "field": "@timestamp"
                }
            }
        }
    },
)
print(resp2)
----
