pinecone.md
  1  ---
  2  title: "Pinecone"
  3  id: integrations-pinecone
  4  description: "Pinecone integration for Haystack"
  5  slug: "/integrations-pinecone"
  6  ---
  7  
  8  <a id="haystack_integrations.components.retrievers.pinecone.embedding_retriever"></a>
  9  
 10  ## Module haystack\_integrations.components.retrievers.pinecone.embedding\_retriever
 11  
 12  <a id="haystack_integrations.components.retrievers.pinecone.embedding_retriever.PineconeEmbeddingRetriever"></a>
 13  
 14  ### PineconeEmbeddingRetriever
 15  
 16  Retrieves documents from the `PineconeDocumentStore`, based on their dense embeddings.
 17  
 18  Usage example:
 19  ```python
 20  import os
 21  from haystack.document_stores.types import DuplicatePolicy
 22  from haystack import Document
 23  from haystack import Pipeline
 24  from haystack.components.embedders import SentenceTransformersTextEmbedder, SentenceTransformersDocumentEmbedder
 25  from haystack_integrations.components.retrievers.pinecone import PineconeEmbeddingRetriever
 26  from haystack_integrations.document_stores.pinecone import PineconeDocumentStore
 27  
 28  os.environ["PINECONE_API_KEY"] = "YOUR_PINECONE_API_KEY"
 29  document_store = PineconeDocumentStore(index="my_index", namespace="my_namespace", dimension=768)
 30  
 31  documents = [Document(content="There are over 7,000 languages spoken around the world today."),
 32               Document(content="Elephants have been observed to behave in a way that indicates..."),
 33               Document(content="In certain places, you can witness the phenomenon of bioluminescent waves.")]
 34  
 35  document_embedder = SentenceTransformersDocumentEmbedder()
 36  document_embedder.warm_up()
 37  documents_with_embeddings = document_embedder.run(documents)
 38  
 39  document_store.write_documents(documents_with_embeddings.get("documents"), policy=DuplicatePolicy.OVERWRITE)
 40  
 41  query_pipeline = Pipeline()
 42  query_pipeline.add_component("text_embedder", SentenceTransformersTextEmbedder())
 43  query_pipeline.add_component("retriever", PineconeEmbeddingRetriever(document_store=document_store))
 44  query_pipeline.connect("text_embedder.embedding", "retriever.query_embedding")
 45  
 46  query = "How many languages are there?"
 47  
 48  res = query_pipeline.run({"text_embedder": {"text": query}})
 49  assert res['retriever']['documents'][0].content == "There are over 7,000 languages spoken around the world today."
 50  ```
 51  
 52  <a id="haystack_integrations.components.retrievers.pinecone.embedding_retriever.PineconeEmbeddingRetriever.__init__"></a>
 53  
 54  #### PineconeEmbeddingRetriever.\_\_init\_\_
 55  
 56  ```python
 57  def __init__(*,
 58               document_store: PineconeDocumentStore,
 59               filters: dict[str, Any] | None = None,
 60               top_k: int = 10,
 61               filter_policy: str | FilterPolicy = FilterPolicy.REPLACE)
 62  ```
 63  
 64  **Arguments**:
 65  
 66  - `document_store`: The Pinecone Document Store.
 67  - `filters`: Filters applied to the retrieved Documents.
 68  - `top_k`: Maximum number of Documents to return.
 69  - `filter_policy`: Policy to determine how filters are applied.
 70  
 71  **Raises**:
 72  
 73  - `ValueError`: If `document_store` is not an instance of `PineconeDocumentStore`.
 74  
 75  <a id="haystack_integrations.components.retrievers.pinecone.embedding_retriever.PineconeEmbeddingRetriever.to_dict"></a>
 76  
 77  #### PineconeEmbeddingRetriever.to\_dict
 78  
 79  ```python
 80  def to_dict() -> dict[str, Any]
 81  ```
 82  
 83  Serializes the component to a dictionary.
 84  
 85  **Returns**:
 86  
 87  Dictionary with serialized data.
 88  
 89  <a id="haystack_integrations.components.retrievers.pinecone.embedding_retriever.PineconeEmbeddingRetriever.from_dict"></a>
 90  
 91  #### PineconeEmbeddingRetriever.from\_dict
 92  
 93  ```python
 94  @classmethod
 95  def from_dict(cls, data: dict[str, Any]) -> "PineconeEmbeddingRetriever"
 96  ```
 97  
 98  Deserializes the component from a dictionary.
 99  
100  **Arguments**:
101  
102  - `data`: Dictionary to deserialize from.
103  
104  **Returns**:
105  
106  Deserialized component.
107  
108  <a id="haystack_integrations.components.retrievers.pinecone.embedding_retriever.PineconeEmbeddingRetriever.run"></a>
109  
110  #### PineconeEmbeddingRetriever.run
111  
112  ```python
113  @component.output_types(documents=list[Document])
114  def run(query_embedding: list[float],
115          filters: dict[str, Any] | None = None,
116          top_k: int | None = None) -> dict[str, list[Document]]
117  ```
118  
119  Retrieve documents from the `PineconeDocumentStore`, based on their dense embeddings.
120  
121  **Arguments**:
122  
123  - `query_embedding`: Embedding of the query.
124  - `filters`: Filters applied to the retrieved Documents. The way runtime filters are applied depends on
125  the `filter_policy` chosen at retriever initialization. See init method docstring for more
126  details.
127  - `top_k`: Maximum number of `Document`s to return.
128  
129  **Returns**:
130  
131  List of Document similar to `query_embedding`.
132  
133  <a id="haystack_integrations.components.retrievers.pinecone.embedding_retriever.PineconeEmbeddingRetriever.run_async"></a>
134  
135  #### PineconeEmbeddingRetriever.run\_async
136  
137  ```python
138  @component.output_types(documents=list[Document])
139  async def run_async(query_embedding: list[float],
140                      filters: dict[str, Any] | None = None,
141                      top_k: int | None = None) -> dict[str, list[Document]]
142  ```
143  
144  Asynchronously retrieve documents from the `PineconeDocumentStore`, based on their dense embeddings.
145  
146  **Arguments**:
147  
148  - `query_embedding`: Embedding of the query.
149  - `filters`: Filters applied to the retrieved Documents. The way runtime filters are applied depends on
150  the `filter_policy` chosen at retriever initialization. See init method docstring for more
151  details.
152  - `top_k`: Maximum number of `Document`s to return.
153  
154  **Returns**:
155  
156  List of Document similar to `query_embedding`.
157  
158  <a id="haystack_integrations.document_stores.pinecone.document_store"></a>
159  
160  ## Module haystack\_integrations.document\_stores.pinecone.document\_store
161  
162  <a id="haystack_integrations.document_stores.pinecone.document_store.METADATA_SUPPORTED_TYPES"></a>
163  
164  #### METADATA\_SUPPORTED\_TYPES
165  
166  List[str] is supported and checked separately
167  
168  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore"></a>
169  
170  ### PineconeDocumentStore
171  
172  A Document Store using [Pinecone vector database](https://www.pinecone.io/).
173  
174  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.__init__"></a>
175  
176  #### PineconeDocumentStore.\_\_init\_\_
177  
178  ```python
179  def __init__(*,
180               api_key: Secret = Secret.from_env_var("PINECONE_API_KEY"),
181               index: str = "default",
182               namespace: str = "default",
183               batch_size: int = 100,
184               dimension: int = 768,
185               spec: dict[str, Any] | None = None,
186               metric: Literal["cosine", "euclidean", "dotproduct"] = "cosine")
187  ```
188  
189  Creates a new PineconeDocumentStore instance.
190  
191  It is meant to be connected to a Pinecone index and namespace.
192  
193  **Arguments**:
194  
195  - `api_key`: The Pinecone API key.
196  - `index`: The Pinecone index to connect to. If the index does not exist, it will be created.
197  - `namespace`: The Pinecone namespace to connect to. If the namespace does not exist, it will be created
198  at the first write.
199  - `batch_size`: The number of documents to write in a single batch. When setting this parameter,
200  consider [documented Pinecone limits](https://docs.pinecone.io/reference/quotas-and-limits).
201  - `dimension`: The dimension of the embeddings. This parameter is only used when creating a new index.
202  - `spec`: The Pinecone spec to use when creating a new index. Allows choosing between serverless and pod
203  deployment options and setting additional parameters. Refer to the
204  [Pinecone documentation](https://docs.pinecone.io/reference/api/control-plane/create_index) for more
205  details.
206  If not provided, a default spec with serverless deployment in the `us-east-1` region will be used
207  (compatible with the free tier).
208  - `metric`: The metric to use for similarity search. This parameter is only used when creating a new index.
209  
210  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.close"></a>
211  
212  #### PineconeDocumentStore.close
213  
214  ```python
215  def close()
216  ```
217  
218  Close the associated synchronous resources.
219  
220  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.close_async"></a>
221  
222  #### PineconeDocumentStore.close\_async
223  
224  ```python
225  async def close_async()
226  ```
227  
228  Close the associated asynchronous resources. To be invoked manually when the Document Store is no longer needed.
229  
230  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.from_dict"></a>
231  
232  #### PineconeDocumentStore.from\_dict
233  
234  ```python
235  @classmethod
236  def from_dict(cls, data: dict[str, Any]) -> "PineconeDocumentStore"
237  ```
238  
239  Deserializes the component from a dictionary.
240  
241  **Arguments**:
242  
243  - `data`: Dictionary to deserialize from.
244  
245  **Returns**:
246  
247  Deserialized component.
248  
249  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.to_dict"></a>
250  
251  #### PineconeDocumentStore.to\_dict
252  
253  ```python
254  def to_dict() -> dict[str, Any]
255  ```
256  
257  Serializes the component to a dictionary.
258  
259  **Returns**:
260  
261  Dictionary with serialized data.
262  
263  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.count_documents"></a>
264  
265  #### PineconeDocumentStore.count\_documents
266  
267  ```python
268  def count_documents() -> int
269  ```
270  
271  Returns how many documents are present in the document store.
272  
273  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.count_documents_async"></a>
274  
275  #### PineconeDocumentStore.count\_documents\_async
276  
277  ```python
278  async def count_documents_async() -> int
279  ```
280  
281  Asynchronously returns how many documents are present in the document store.
282  
283  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.write_documents"></a>
284  
285  #### PineconeDocumentStore.write\_documents
286  
287  ```python
288  def write_documents(documents: list[Document],
289                      policy: DuplicatePolicy = DuplicatePolicy.NONE) -> int
290  ```
291  
292  Writes Documents to Pinecone.
293  
294  **Arguments**:
295  
296  - `documents`: A list of Documents to write to the document store.
297  - `policy`: The duplicate policy to use when writing documents.
298  PineconeDocumentStore only supports `DuplicatePolicy.OVERWRITE`.
299  
300  **Returns**:
301  
302  The number of documents written to the document store.
303  
304  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.write_documents_async"></a>
305  
306  #### PineconeDocumentStore.write\_documents\_async
307  
308  ```python
309  async def write_documents_async(
310          documents: list[Document],
311          policy: DuplicatePolicy = DuplicatePolicy.NONE) -> int
312  ```
313  
314  Asynchronously writes Documents to Pinecone.
315  
316  **Arguments**:
317  
318  - `documents`: A list of Documents to write to the document store.
319  - `policy`: The duplicate policy to use when writing documents.
320  PineconeDocumentStore only supports `DuplicatePolicy.OVERWRITE`.
321  
322  **Returns**:
323  
324  The number of documents written to the document store.
325  
326  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.filter_documents"></a>
327  
328  #### PineconeDocumentStore.filter\_documents
329  
330  ```python
331  def filter_documents(filters: dict[str, Any] | None = None) -> list[Document]
332  ```
333  
334  Returns the documents that match the filters provided.
335  
336  For a detailed specification of the filters,
337  refer to the [documentation](https://docs.haystack.deepset.ai/docs/metadata-filtering)
338  
339  **Arguments**:
340  
341  - `filters`: The filters to apply to the document list.
342  
343  **Returns**:
344  
345  A list of Documents that match the given filters.
346  
347  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.filter_documents_async"></a>
348  
349  #### PineconeDocumentStore.filter\_documents\_async
350  
351  ```python
352  async def filter_documents_async(
353          filters: dict[str, Any] | None = None) -> list[Document]
354  ```
355  
356  Asynchronously returns the documents that match the filters provided.
357  
358  **Arguments**:
359  
360  - `filters`: The filters to apply to the document list.
361  
362  **Returns**:
363  
364  A list of Documents that match the given filters.
365  
366  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.delete_documents"></a>
367  
368  #### PineconeDocumentStore.delete\_documents
369  
370  ```python
371  def delete_documents(document_ids: list[str]) -> None
372  ```
373  
374  Deletes documents that match the provided `document_ids` from the document store.
375  
376  **Arguments**:
377  
378  - `document_ids`: the document ids to delete
379  
380  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.delete_documents_async"></a>
381  
382  #### PineconeDocumentStore.delete\_documents\_async
383  
384  ```python
385  async def delete_documents_async(document_ids: list[str]) -> None
386  ```
387  
388  Asynchronously deletes documents that match the provided `document_ids` from the document store.
389  
390  **Arguments**:
391  
392  - `document_ids`: the document ids to delete
393  
394  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.delete_all_documents"></a>
395  
396  #### PineconeDocumentStore.delete\_all\_documents
397  
398  ```python
399  def delete_all_documents() -> None
400  ```
401  
402  Deletes all documents in the document store.
403  
404  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.delete_all_documents_async"></a>
405  
406  #### PineconeDocumentStore.delete\_all\_documents\_async
407  
408  ```python
409  async def delete_all_documents_async() -> None
410  ```
411  
412  Asynchronously deletes all documents in the document store.
413  
414  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.delete_by_filter"></a>
415  
416  #### PineconeDocumentStore.delete\_by\_filter
417  
418  ```python
419  def delete_by_filter(filters: dict[str, Any]) -> int
420  ```
421  
422  Deletes all documents that match the provided filters.
423  
424  Pinecone does not support server-side delete by filter, so this method
425  first searches for matching documents, then deletes them by ID.
426  
427  **Arguments**:
428  
429  - `filters`: The filters to apply to select documents for deletion.
430  For filter syntax, see [Haystack metadata filtering](https://docs.haystack.deepset.ai/docs/metadata-filtering)
431  
432  **Returns**:
433  
434  The number of documents deleted.
435  
436  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.delete_by_filter_async"></a>
437  
438  #### PineconeDocumentStore.delete\_by\_filter\_async
439  
440  ```python
441  async def delete_by_filter_async(filters: dict[str, Any]) -> int
442  ```
443  
444  Asynchronously deletes all documents that match the provided filters.
445  
446  Pinecone does not support server-side delete by filter, so this method
447  first searches for matching documents, then deletes them by ID.
448  
449  **Arguments**:
450  
451  - `filters`: The filters to apply to select documents for deletion.
452  For filter syntax, see [Haystack metadata filtering](https://docs.haystack.deepset.ai/docs/metadata-filtering)
453  
454  **Returns**:
455  
456  The number of documents deleted.
457  
458  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.update_by_filter"></a>
459  
460  #### PineconeDocumentStore.update\_by\_filter
461  
462  ```python
463  def update_by_filter(filters: dict[str, Any], meta: dict[str, Any]) -> int
464  ```
465  
466  Updates the metadata of all documents that match the provided filters.
467  
468  Pinecone does not support server-side update by filter, so this method
469  first searches for matching documents, then updates their metadata and re-writes them.
470  
471  **Arguments**:
472  
473  - `filters`: The filters to apply to select documents for updating.
474  For filter syntax, see [Haystack metadata filtering](https://docs.haystack.deepset.ai/docs/metadata-filtering)
475  - `meta`: The metadata fields to update. This will be merged with existing metadata.
476  
477  **Returns**:
478  
479  The number of documents updated.
480  
481  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.update_by_filter_async"></a>
482  
483  #### PineconeDocumentStore.update\_by\_filter\_async
484  
485  ```python
486  async def update_by_filter_async(filters: dict[str, Any],
487                                   meta: dict[str, Any]) -> int
488  ```
489  
490  Asynchronously updates the metadata of all documents that match the provided filters.
491  
492  Pinecone does not support server-side update by filter, so this method
493  first searches for matching documents, then updates their metadata and re-writes them.
494  
495  **Arguments**:
496  
497  - `filters`: The filters to apply to select documents for updating.
498  For filter syntax, see [Haystack metadata filtering](https://docs.haystack.deepset.ai/docs/metadata-filtering)
499  - `meta`: The metadata fields to update. This will be merged with existing metadata.
500  
501  **Returns**:
502  
503  The number of documents updated.
504  
505  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.count_documents_by_filter"></a>
506  
507  #### PineconeDocumentStore.count\_documents\_by\_filter
508  
509  ```python
510  def count_documents_by_filter(filters: dict[str, Any]) -> int
511  ```
512  
513  Returns the count of documents that match the provided filters.
514  
515  Note: Due to Pinecone's limitations, this method fetches documents and counts them.
516  For large result sets, this is subject to Pinecone's TOP_K_LIMIT of 1000 documents.
517  
518  **Arguments**:
519  
520  - `filters`: The filters to apply to the document list.
521  For filter syntax, see [Haystack metadata filtering](https://docs.haystack.deepset.ai/docs/metadata-filtering)
522  
523  **Returns**:
524  
525  The number of documents that match the filters.
526  
527  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.count_documents_by_filter_async"></a>
528  
529  #### PineconeDocumentStore.count\_documents\_by\_filter\_async
530  
531  ```python
532  async def count_documents_by_filter_async(filters: dict[str, Any]) -> int
533  ```
534  
535  Asynchronously returns the count of documents that match the provided filters.
536  
537  Note: Due to Pinecone's limitations, this method fetches documents and counts them.
538  For large result sets, this is subject to Pinecone's TOP_K_LIMIT of 1000 documents.
539  
540  **Arguments**:
541  
542  - `filters`: The filters to apply to the document list.
543  
544  **Returns**:
545  
546  The number of documents that match the filters.
547  
548  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.count_unique_metadata_by_filter"></a>
549  
550  #### PineconeDocumentStore.count\_unique\_metadata\_by\_filter
551  
552  ```python
553  def count_unique_metadata_by_filter(
554          filters: dict[str, Any], metadata_fields: list[str]) -> dict[str, int]
555  ```
556  
557  Counts unique values for each specified metadata field in documents matching the filters.
558  
559  Note: Due to Pinecone's limitations, this method fetches documents and aggregates in Python.
560  Subject to Pinecone's TOP_K_LIMIT of 1000 documents.
561  
562  **Arguments**:
563  
564  - `filters`: The filters to apply to select documents.
565  - `metadata_fields`: List of metadata field names to count unique values for.
566  
567  **Returns**:
568  
569  Dictionary mapping field names to counts of unique values.
570  
571  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.count_unique_metadata_by_filter_async"></a>
572  
573  #### PineconeDocumentStore.count\_unique\_metadata\_by\_filter\_async
574  
575  ```python
576  async def count_unique_metadata_by_filter_async(
577          filters: dict[str, Any], metadata_fields: list[str]) -> dict[str, int]
578  ```
579  
580  Asynchronously counts unique values for each specified metadata field in documents matching the filters.
581  
582  Note: Due to Pinecone's limitations, this method fetches documents and aggregates in Python.
583  Subject to Pinecone's TOP_K_LIMIT of 1000 documents.
584  
585  **Arguments**:
586  
587  - `filters`: The filters to apply to select documents.
588  - `metadata_fields`: List of metadata field names to count unique values for.
589  
590  **Returns**:
591  
592  Dictionary mapping field names to counts of unique values.
593  
594  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.get_metadata_fields_info"></a>
595  
596  #### PineconeDocumentStore.get\_metadata\_fields\_info
597  
598  ```python
599  def get_metadata_fields_info() -> dict[str, dict[str, str]]
600  ```
601  
602  Returns information about metadata fields and their types by sampling documents.
603  
604  Note: Pinecone doesn't provide a schema introspection API, so this method infers field types
605  by examining the metadata of documents stored in the index (up to 1000 documents).
606  
607  Type mappings:
608  - 'text': Document content field
609  - 'keyword': String metadata values
610  - 'long': Numeric metadata values (int or float)
611  - 'boolean': Boolean metadata values
612  
613  **Returns**:
614  
615  Dictionary mapping field names to type information.
616  Example:
617  ```python
618  {
619      'content': {'type': 'text'},
620      'category': {'type': 'keyword'},
621      'priority': {'type': 'long'},
622  }
623  ```
624  
625  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.get_metadata_fields_info_async"></a>
626  
627  #### PineconeDocumentStore.get\_metadata\_fields\_info\_async
628  
629  ```python
630  async def get_metadata_fields_info_async() -> dict[str, dict[str, str]]
631  ```
632  
633  Asynchronously returns information about metadata fields and their types by sampling documents.
634  
635  Note: Pinecone doesn't provide a schema introspection API, so this method infers field types
636  by examining the metadata of documents stored in the index (up to 1000 documents).
637  
638  Type mappings:
639  - 'text': Document content field
640  - 'keyword': String metadata values
641  - 'long': Numeric metadata values (int or float)
642  - 'boolean': Boolean metadata values
643  
644  **Returns**:
645  
646  Dictionary mapping field names to type information.
647  Example:
648  ```python
649  {
650      'content': {'type': 'text'},
651      'category': {'type': 'keyword'},
652      'priority': {'type': 'long'},
653  }
654  ```
655  
656  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.get_metadata_field_min_max"></a>
657  
658  #### PineconeDocumentStore.get\_metadata\_field\_min\_max
659  
660  ```python
661  def get_metadata_field_min_max(metadata_field: str) -> dict[str, Any]
662  ```
663  
664  Returns the minimum and maximum values for a metadata field.
665  
666  Supports numeric (int, float), boolean, and string (keyword) types:
667  - Numeric: Returns min/max based on numeric value
668  - Boolean: Returns False as min, True as max
669  - String: Returns min/max based on alphabetical ordering
670  
671  Note: This method fetches all documents and computes min/max in Python.
672  Subject to Pinecone's TOP_K_LIMIT of 1000 documents.
673  
674  **Arguments**:
675  
676  - `metadata_field`: The metadata field name to analyze.
677  
678  **Raises**:
679  
680  - `ValueError`: If the field doesn't exist or has no values.
681  
682  **Returns**:
683  
684  Dictionary with 'min' and 'max' keys.
685  
686  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.get_metadata_field_min_max_async"></a>
687  
688  #### PineconeDocumentStore.get\_metadata\_field\_min\_max\_async
689  
690  ```python
691  async def get_metadata_field_min_max_async(
692          metadata_field: str) -> dict[str, Any]
693  ```
694  
695  Asynchronously returns the minimum and maximum values for a metadata field.
696  
697  Supports numeric (int, float), boolean, and string (keyword) types:
698  - Numeric: Returns min/max based on numeric value
699  - Boolean: Returns False as min, True as max
700  - String: Returns min/max based on alphabetical ordering
701  
702  Note: This method fetches all documents and computes min/max in Python.
703  Subject to Pinecone's TOP_K_LIMIT of 1000 documents.
704  
705  **Arguments**:
706  
707  - `metadata_field`: The metadata field name to analyze.
708  
709  **Raises**:
710  
711  - `ValueError`: If the field doesn't exist or has no values.
712  
713  **Returns**:
714  
715  Dictionary with 'min' and 'max' keys.
716  
717  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.get_metadata_field_unique_values"></a>
718  
719  #### PineconeDocumentStore.get\_metadata\_field\_unique\_values
720  
721  ```python
722  def get_metadata_field_unique_values(metadata_field: str,
723                                       search_term: str | None = None,
724                                       from_: int = 0,
725                                       size: int = 10) -> tuple[list[str], int]
726  ```
727  
728  Retrieves unique values for a metadata field with optional search and pagination.
729  
730  Note: This method fetches documents and extracts unique values in Python.
731  Subject to Pinecone's TOP_K_LIMIT of 1000 documents.
732  
733  **Arguments**:
734  
735  - `metadata_field`: The metadata field name to get unique values for.
736  - `search_term`: Optional search term to filter values (case-insensitive substring match).
737  - `from_`: Starting offset for pagination (default: 0).
738  - `size`: Number of values to return (default: 10).
739  
740  **Returns**:
741  
742  Tuple of (list of unique values, total count of matching values).
743  
744  <a id="haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore.get_metadata_field_unique_values_async"></a>
745  
746  #### PineconeDocumentStore.get\_metadata\_field\_unique\_values\_async
747  
748  ```python
749  async def get_metadata_field_unique_values_async(
750          metadata_field: str,
751          search_term: str | None = None,
752          from_: int = 0,
753          size: int = 10) -> tuple[list[str], int]
754  ```
755  
756  Asynchronously retrieves unique values for a metadata field with optional search and pagination.
757  
758  Note: This method fetches documents and extracts unique values in Python.
759  Subject to Pinecone's TOP_K_LIMIT of 1000 documents.
760  
761  **Arguments**:
762  
763  - `metadata_field`: The metadata field name to get unique values for.
764  - `search_term`: Optional search term to filter values (case-insensitive substring match).
765  - `from_`: Starting offset for pagination (default: 0).
766  - `size`: Number of values to return (default: 10).
767  
768  **Returns**:
769  
770  Tuple of (list of unique values, total count of matching values).
771