// This file is autogenerated, DO NOT EDIT
// mapping/types/date.asciidoc:188

[source, python]
----
resp = client.indices.create(
    index="my-index-000001",
    mappings={
        "properties": {
            "date": {
                "type": "date",
                "format": "strict_date_optional_time||epoch_second"
            }
        }
    },
)
print(resp)

resp1 = client.index(
    index="my-index-000001",
    id="example",
    refresh=True,
    document={
        "date": 1618321898
    },
)
print(resp1)

resp2 = client.search(
    index="my-index-000001",
    fields=[
        {
            "field": "date"
        }
    ],
    source=False,
)
print(resp2)
----
