# Indexes ## List Vectorize Indexes `vectorize.indexes.list(IndexListParams**kwargs) -> SyncSinglePage[CreateIndex]` **get** `/accounts/{account_id}/vectorize/v2/indexes` Returns a list of Vectorize Indexes ### Parameters - `account_id: str` Identifier ### Returns - `class CreateIndex: …` - `config: Optional[IndexDimensionConfiguration]` - `dimensions: int` Specifies the number of dimensions for the index - `metric: Literal["cosine", "euclidean", "dot-product"]` Specifies the type of metric to use calculating distance. - `"cosine"` - `"euclidean"` - `"dot-product"` - `created_on: Optional[datetime]` Specifies the timestamp the resource was created as an ISO8601 string. - `description: Optional[str]` Specifies the description of the index. - `modified_on: Optional[datetime]` Specifies the timestamp the resource was modified as an ISO8601 string. - `name: Optional[str]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.vectorize.indexes.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.config) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "config": { "dimensions": 768, "metric": "cosine" }, "created_on": "2022-11-15T18:25:44.442097Z", "description": "This is my example index.", "modified_on": "2022-11-15T18:25:44.442097Z", "name": "example-index" } ], "success": true } ``` ## Get Vectorize Index `vectorize.indexes.get(strindex_name, IndexGetParams**kwargs) -> CreateIndex` **get** `/accounts/{account_id}/vectorize/v2/indexes/{index_name}` Returns the specified Vectorize Index. ### Parameters - `account_id: str` Identifier - `index_name: str` ### Returns - `class CreateIndex: …` - `config: Optional[IndexDimensionConfiguration]` - `dimensions: int` Specifies the number of dimensions for the index - `metric: Literal["cosine", "euclidean", "dot-product"]` Specifies the type of metric to use calculating distance. - `"cosine"` - `"euclidean"` - `"dot-product"` - `created_on: Optional[datetime]` Specifies the timestamp the resource was created as an ISO8601 string. - `description: Optional[str]` Specifies the description of the index. - `modified_on: Optional[datetime]` Specifies the timestamp the resource was modified as an ISO8601 string. - `name: Optional[str]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) create_index = client.vectorize.indexes.get( index_name="example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(create_index.config) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "config": { "dimensions": 768, "metric": "cosine" }, "created_on": "2022-11-15T18:25:44.442097Z", "description": "This is my example index.", "modified_on": "2022-11-15T18:25:44.442097Z", "name": "example-index" }, "success": true } ``` ## Create Vectorize Index `vectorize.indexes.create(IndexCreateParams**kwargs) -> CreateIndex` **post** `/accounts/{account_id}/vectorize/v2/indexes` Creates and returns a new Vectorize Index. ### Parameters - `account_id: str` Identifier - `config: Config` Specifies the type of configuration to use for the index. - `class IndexDimensionConfiguration: …` - `dimensions: int` Specifies the number of dimensions for the index - `metric: Literal["cosine", "euclidean", "dot-product"]` Specifies the type of metric to use calculating distance. - `"cosine"` - `"euclidean"` - `"dot-product"` - `class ConfigVectorizeIndexPresetConfiguration: …` - `preset: Literal["@cf/baai/bge-small-en-v1.5", "@cf/baai/bge-base-en-v1.5", "@cf/baai/bge-large-en-v1.5", 2 more]` Specifies the preset to use for the index. - `"@cf/baai/bge-small-en-v1.5"` - `"@cf/baai/bge-base-en-v1.5"` - `"@cf/baai/bge-large-en-v1.5"` - `"openai/text-embedding-ada-002"` - `"cohere/embed-multilingual-v2.0"` - `name: str` - `description: Optional[str]` Specifies the description of the index. ### Returns - `class CreateIndex: …` - `config: Optional[IndexDimensionConfiguration]` - `dimensions: int` Specifies the number of dimensions for the index - `metric: Literal["cosine", "euclidean", "dot-product"]` Specifies the type of metric to use calculating distance. - `"cosine"` - `"euclidean"` - `"dot-product"` - `created_on: Optional[datetime]` Specifies the timestamp the resource was created as an ISO8601 string. - `description: Optional[str]` Specifies the description of the index. - `modified_on: Optional[datetime]` Specifies the timestamp the resource was modified as an ISO8601 string. - `name: Optional[str]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) create_index = client.vectorize.indexes.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", config={ "dimensions": 768, "metric": "cosine", }, name="example-index", ) print(create_index.config) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "config": { "dimensions": 768, "metric": "cosine" }, "created_on": "2022-11-15T18:25:44.442097Z", "description": "This is my example index.", "modified_on": "2022-11-15T18:25:44.442097Z", "name": "example-index" }, "success": true } ``` ## Delete Vectorize Index `vectorize.indexes.delete(strindex_name, IndexDeleteParams**kwargs) -> IndexDeleteResponse` **delete** `/accounts/{account_id}/vectorize/v2/indexes/{index_name}` Deletes the specified Vectorize Index. ### Parameters - `account_id: str` Identifier - `index_name: str` ### Returns - `Union[str, object, null]` - `str` - `object` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) index = client.vectorize.indexes.delete( index_name="example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(index) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": {}, "success": true } ``` ## Insert Vectors `vectorize.indexes.insert(strindex_name, IndexInsertParams**kwargs) -> IndexInsertResponse` **post** `/accounts/{account_id}/vectorize/v2/indexes/{index_name}/insert` Inserts vectors into the specified index and returns a mutation id corresponding to the vectors enqueued for insertion. ### Parameters - `account_id: str` Identifier - `index_name: str` - `body: FileTypes` ndjson file containing vectors to insert. - `unparsable_behavior: Optional[Literal["error", "discard"]]` Behavior for ndjson parse failures. - `"error"` - `"discard"` ### Returns - `class IndexInsertResponse: …` - `mutation_id: Optional[str]` The unique identifier for the async mutation operation containing the changeset. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.vectorize.indexes.insert( index_name="example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", body=b"Example data", ) print(response.mutation_id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "mutationId": "0000aaaa-11bb-22cc-33dd-444444eeeeee" }, "success": true } ``` ## Query Vectors `vectorize.indexes.query(strindex_name, IndexQueryParams**kwargs) -> IndexQueryResponse` **post** `/accounts/{account_id}/vectorize/v2/indexes/{index_name}/query` Finds vectors closest to a given vector in an index. ### Parameters - `account_id: str` Identifier - `index_name: str` - `vector: Iterable[float]` The search vector that will be used to find the nearest neighbors. - `filter: Optional[object]` A metadata filter expression used to limit nearest neighbor results. - `return_metadata: Optional[Literal["none", "indexed", "all"]]` Whether to return no metadata, indexed metadata or all metadata associated with the closest vectors. - `"none"` - `"indexed"` - `"all"` - `return_values: Optional[bool]` Whether to return the values associated with the closest vectors. - `top_k: Optional[float]` The number of nearest neighbors to find. ### Returns - `class IndexQueryResponse: …` - `count: Optional[int]` Specifies the count of vectors returned by the search - `matches: Optional[List[Match]]` Array of vectors matched by the search - `id: Optional[str]` Identifier for a Vector - `metadata: Optional[object]` - `namespace: Optional[str]` - `score: Optional[float]` The score of the vector according to the index's distance metric - `values: Optional[List[float]]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.vectorize.indexes.query( index_name="example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", vector=[0.5, 0.5, 0.5], ) print(response.count) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "count": 0, "matches": [ { "id": "some-vector-id-023e105f4ecef8ad9ca31a8372d0c353", "metadata": {}, "namespace": "namespace", "score": 0, "values": [ 0 ] } ] }, "success": true } ``` ## Upsert Vectors `vectorize.indexes.upsert(strindex_name, IndexUpsertParams**kwargs) -> IndexUpsertResponse` **post** `/accounts/{account_id}/vectorize/v2/indexes/{index_name}/upsert` Upserts vectors into the specified index, creating them if they do not exist and returns a mutation id corresponding to the vectors enqueued for upsertion. ### Parameters - `account_id: str` Identifier - `index_name: str` - `body: FileTypes` ndjson file containing vectors to upsert. - `unparsable_behavior: Optional[Literal["error", "discard"]]` Behavior for ndjson parse failures. - `"error"` - `"discard"` ### Returns - `class IndexUpsertResponse: …` - `mutation_id: Optional[str]` The unique identifier for the async mutation operation containing the changeset. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.vectorize.indexes.upsert( index_name="example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", body=b"Example data", ) print(response.mutation_id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "mutationId": "0000aaaa-11bb-22cc-33dd-444444eeeeee" }, "success": true } ``` ## Delete Vectors By Identifier `vectorize.indexes.delete_by_ids(strindex_name, IndexDeleteByIDsParams**kwargs) -> IndexDeleteByIDsResponse` **post** `/accounts/{account_id}/vectorize/v2/indexes/{index_name}/delete_by_ids` Delete a set of vectors from an index by their vector identifiers. ### Parameters - `account_id: str` Identifier - `index_name: str` - `ids: Optional[SequenceNotStr[str]]` A list of vector identifiers to delete from the index indicated by the path. ### Returns - `class IndexDeleteByIDsResponse: …` - `mutation_id: Optional[str]` The unique identifier for the async mutation operation containing the changeset. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.vectorize.indexes.delete_by_ids( index_name="example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(response.mutation_id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "mutationId": "0000aaaa-11bb-22cc-33dd-444444eeeeee" }, "success": true } ``` ## Get Vectors By Identifier `vectorize.indexes.get_by_ids(strindex_name, IndexGetByIDsParams**kwargs) -> object` **post** `/accounts/{account_id}/vectorize/v2/indexes/{index_name}/get_by_ids` Get a set of vectors from an index by their vector identifiers. ### Parameters - `account_id: str` Identifier - `index_name: str` - `ids: Optional[SequenceNotStr[str]]` A list of vector identifiers to retrieve from the index indicated by the path. ### Returns - `object` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.vectorize.indexes.get_by_ids( index_name="example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(response) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "id": "some-vector-id", "metadata": { "another-key": "another-value", "customer-id": 442 }, "values": [ 0.812, 0.621, 0.261 ] }, { "id": "other-vector-id", "metadata": { "another-key": "with-a-value", "customer-id": 2151 }, "namespace": "namespaced", "values": [ 0.961, 0.751, 0.661 ] } ], "success": true } ``` ## Get Vectorize Index Info `vectorize.indexes.info(strindex_name, IndexInfoParams**kwargs) -> IndexInfoResponse` **get** `/accounts/{account_id}/vectorize/v2/indexes/{index_name}/info` Get information about a vectorize index. ### Parameters - `account_id: str` Identifier - `index_name: str` ### Returns - `class IndexInfoResponse: …` - `dimensions: Optional[int]` Specifies the number of dimensions for the index - `processed_up_to_datetime: Optional[datetime]` Specifies the timestamp the last mutation batch was processed as an ISO8601 string. - `processed_up_to_mutation: Optional[str]` The unique identifier for the async mutation operation containing the changeset. - `vector_count: Optional[int]` Specifies the number of vectors present in the index ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.vectorize.indexes.info( index_name="example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(response.dimensions) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "dimensions": 768, "processedUpToDatetime": "2024-07-22T18:25:44.442097Z", "processedUpToMutation": "0000aaaa-11bb-22cc-33dd-444444eeeeee", "vectorCount": 300000 }, "success": true } ``` ## List Vectors `vectorize.indexes.list_vectors(strindex_name, IndexListVectorsParams**kwargs) -> IndexListVectorsResponse` **get** `/accounts/{account_id}/vectorize/v2/indexes/{index_name}/list` Returns a paginated list of vector identifiers from the specified index. ### Parameters - `account_id: str` Identifier - `index_name: str` - `count: Optional[int]` Maximum number of vectors to return - `cursor: Optional[str]` Cursor for pagination to get the next page of results ### Returns - `class IndexListVectorsResponse: …` - `count: int` Number of vectors returned in this response - `is_truncated: bool` Whether there are more vectors available beyond this response - `total_count: int` Total number of vectors in the index - `vectors: List[Vector]` Array of vector items - `id: str` Identifier for a Vector - `cursor_expiration_timestamp: Optional[datetime]` When the cursor expires as an ISO8601 string - `next_cursor: Optional[str]` Cursor for the next page of results ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.vectorize.indexes.list_vectors( index_name="example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(response.count) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "count": 100, "isTruncated": true, "totalCount": 500, "vectors": [ { "id": "some-vector-id-023e105f4ecef8ad9ca31a8372d0c353" } ], "cursorExpirationTimestamp": "2025-08-12T20:32:52.469144957+00:00", "nextCursor": "suUTaDY5PFUiRweVccnzyt9n75suNPbXHPshvCzue5mHjtj7Letjvzlza9eGj099" }, "success": true } ``` ## Domain Types ### Create Index - `class CreateIndex: …` - `config: Optional[IndexDimensionConfiguration]` - `dimensions: int` Specifies the number of dimensions for the index - `metric: Literal["cosine", "euclidean", "dot-product"]` Specifies the type of metric to use calculating distance. - `"cosine"` - `"euclidean"` - `"dot-product"` - `created_on: Optional[datetime]` Specifies the timestamp the resource was created as an ISO8601 string. - `description: Optional[str]` Specifies the description of the index. - `modified_on: Optional[datetime]` Specifies the timestamp the resource was modified as an ISO8601 string. - `name: Optional[str]` ### Index Delete Vectors By ID - `class IndexDeleteVectorsByID: …` - `count: Optional[int]` The count of the vectors successfully deleted. - `ids: Optional[List[str]]` Array of vector identifiers of the vectors that were successfully processed for deletion. ### Index Dimension Configuration - `class IndexDimensionConfiguration: …` - `dimensions: int` Specifies the number of dimensions for the index - `metric: Literal["cosine", "euclidean", "dot-product"]` Specifies the type of metric to use calculating distance. - `"cosine"` - `"euclidean"` - `"dot-product"` ### Index Insert - `class IndexInsert: …` - `count: Optional[int]` Specifies the count of the vectors successfully inserted. - `ids: Optional[List[str]]` Array of vector identifiers of the vectors successfully inserted. ### Index Query - `class IndexQuery: …` - `count: Optional[int]` Specifies the count of vectors returned by the search - `matches: Optional[List[Match]]` Array of vectors matched by the search - `id: Optional[str]` Identifier for a Vector - `metadata: Optional[object]` - `score: Optional[float]` The score of the vector according to the index's distance metric - `values: Optional[List[float]]` ### Index Upsert - `class IndexUpsert: …` - `count: Optional[int]` Specifies the count of the vectors successfully inserted. - `ids: Optional[List[str]]` Array of vector identifiers of the vectors successfully inserted. ### Index Delete Response - `Union[str, object, null]` - `str` - `object` ### Index Insert Response - `class IndexInsertResponse: …` - `mutation_id: Optional[str]` The unique identifier for the async mutation operation containing the changeset. ### Index Query Response - `class IndexQueryResponse: …` - `count: Optional[int]` Specifies the count of vectors returned by the search - `matches: Optional[List[Match]]` Array of vectors matched by the search - `id: Optional[str]` Identifier for a Vector - `metadata: Optional[object]` - `namespace: Optional[str]` - `score: Optional[float]` The score of the vector according to the index's distance metric - `values: Optional[List[float]]` ### Index Upsert Response - `class IndexUpsertResponse: …` - `mutation_id: Optional[str]` The unique identifier for the async mutation operation containing the changeset. ### Index Delete By IDs Response - `class IndexDeleteByIDsResponse: …` - `mutation_id: Optional[str]` The unique identifier for the async mutation operation containing the changeset. ### Index Info Response - `class IndexInfoResponse: …` - `dimensions: Optional[int]` Specifies the number of dimensions for the index - `processed_up_to_datetime: Optional[datetime]` Specifies the timestamp the last mutation batch was processed as an ISO8601 string. - `processed_up_to_mutation: Optional[str]` The unique identifier for the async mutation operation containing the changeset. - `vector_count: Optional[int]` Specifies the number of vectors present in the index ### Index List Vectors Response - `class IndexListVectorsResponse: …` - `count: int` Number of vectors returned in this response - `is_truncated: bool` Whether there are more vectors available beyond this response - `total_count: int` Total number of vectors in the index - `vectors: List[Vector]` Array of vector items - `id: str` Identifier for a Vector - `cursor_expiration_timestamp: Optional[datetime]` When the cursor expires as an ISO8601 string - `next_cursor: Optional[str]` Cursor for the next page of results # Metadata Index ## List Metadata Indexes `vectorize.indexes.metadata_index.list(strindex_name, MetadataIndexListParams**kwargs) -> MetadataIndexListResponse` **get** `/accounts/{account_id}/vectorize/v2/indexes/{index_name}/metadata_index/list` List Metadata Indexes for the specified Vectorize Index. ### Parameters - `account_id: str` Identifier - `index_name: str` ### Returns - `class MetadataIndexListResponse: …` - `metadata_indexes: Optional[List[MetadataIndex]]` Array of indexed metadata properties. - `index_type: Optional[Literal["string", "number", "boolean"]]` Specifies the type of indexed metadata property. - `"string"` - `"number"` - `"boolean"` - `property_name: Optional[str]` Specifies the indexed metadata property. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) metadata_indices = client.vectorize.indexes.metadata_index.list( index_name="example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(metadata_indices.metadata_indexes) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "metadataIndexes": [ { "indexType": "number", "propertyName": "some-num-prop" }, { "indexType": "string", "propertyName": "some-str-prop" }, { "indexType": "boolean", "propertyName": "some-bool-prop" } ] }, "success": true } ``` ## Create Metadata Index `vectorize.indexes.metadata_index.create(strindex_name, MetadataIndexCreateParams**kwargs) -> MetadataIndexCreateResponse` **post** `/accounts/{account_id}/vectorize/v2/indexes/{index_name}/metadata_index/create` Enable metadata filtering based on metadata property. Limited to 10 properties. ### Parameters - `account_id: str` Identifier - `index_name: str` - `index_type: Literal["string", "number", "boolean"]` Specifies the type of metadata property to index. - `"string"` - `"number"` - `"boolean"` - `property_name: str` Specifies the metadata property to index. ### Returns - `class MetadataIndexCreateResponse: …` - `mutation_id: Optional[str]` The unique identifier for the async mutation operation containing the changeset. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) metadata_index = client.vectorize.indexes.metadata_index.create( index_name="example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", index_type="string", property_name="random_metadata_property", ) print(metadata_index.mutation_id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "mutationId": "0000aaaa-11bb-22cc-33dd-444444eeeeee" }, "success": true } ``` ## Delete Metadata Index `vectorize.indexes.metadata_index.delete(strindex_name, MetadataIndexDeleteParams**kwargs) -> MetadataIndexDeleteResponse` **post** `/accounts/{account_id}/vectorize/v2/indexes/{index_name}/metadata_index/delete` Allow Vectorize to delete the specified metadata index. ### Parameters - `account_id: str` Identifier - `index_name: str` - `property_name: str` Specifies the metadata property for which the index must be deleted. ### Returns - `class MetadataIndexDeleteResponse: …` - `mutation_id: Optional[str]` The unique identifier for the async mutation operation containing the changeset. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) metadata_index = client.vectorize.indexes.metadata_index.delete( index_name="example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", property_name="random_metadata_property", ) print(metadata_index.mutation_id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "mutationId": "0000aaaa-11bb-22cc-33dd-444444eeeeee" }, "success": true } ``` ## Domain Types ### Metadata Index List Response - `class MetadataIndexListResponse: …` - `metadata_indexes: Optional[List[MetadataIndex]]` Array of indexed metadata properties. - `index_type: Optional[Literal["string", "number", "boolean"]]` Specifies the type of indexed metadata property. - `"string"` - `"number"` - `"boolean"` - `property_name: Optional[str]` Specifies the indexed metadata property. ### Metadata Index Create Response - `class MetadataIndexCreateResponse: …` - `mutation_id: Optional[str]` The unique identifier for the async mutation operation containing the changeset. ### Metadata Index Delete Response - `class MetadataIndexDeleteResponse: …` - `mutation_id: Optional[str]` The unique identifier for the async mutation operation containing the changeset.