// This file is autogenerated, DO NOT EDIT
// mapping/types/rank-vectors.asciidoc:159

[source, python]
----
resp = client.indices.create(
    index="my-rank-vectors-bit",
    mappings={
        "properties": {
            "my_vector": {
                "type": "rank_vectors",
                "element_type": "bit"
            }
        }
    },
)
print(resp)

resp1 = client.bulk(
    index="my-rank-vectors-bit",
    refresh=True,
    operations=[
        {
            "index": {
                "_id": "1"
            }
        },
        {
            "my_vector": [
                127,
                -127,
                0,
                1,
                42
            ]
        },
        {
            "index": {
                "_id": "2"
            }
        },
        {
            "my_vector": "8100012a7f"
        }
    ],
)
print(resp1)

resp2 = client.search(
    index="my-rank-vectors-bit",
    query={
        "script_score": {
            "query": {
                "match_all": {}
            },
            "script": {
                "source": "maxSimDotProduct(params.query_vector, 'my_vector')",
                "params": {
                    "query_vector": [
                        [
                            0.35,
                            0.77,
                            0.95,
                            0.15,
                            0.11,
                            0.08,
                            0.58,
                            0.06,
                            0.44,
                            0.52,
                            0.21,
                            0.62,
                            0.65,
                            0.16,
                            0.64,
                            0.39,
                            0.93,
                            0.06,
                            0.93,
                            0.31,
                            0.92,
                            0,
                            0.66,
                            0.86,
                            0.92,
                            0.03,
                            0.81,
                            0.31,
                            0.2,
                            0.92,
                            0.95,
                            0.64,
                            0.19,
                            0.26,
                            0.77,
                            0.64,
                            0.78,
                            0.32,
                            0.97,
                            0.84
                        ]
                    ]
                }
            }
        }
    },
)
print(resp2)
----
