Repository: deepset-ai/haystack

Issue:
Pinecone define pod, pod_type and index_config
**Is your feature request related to a problem? Please describe.**
Pinecone allows to set the number of pods and the pod type when creating an index, through the `pod` and `pod_type` parameters, as well as the index configuration through `index_config` which allows for a dictionary to define more complex configuration of the index.

Here is an example:
`pinecone.configure_index("example-index", pods=2, pod_type="s1.x2", index_config=index_config)` in this case it allows you to create an index with a defined number of pods and the pod_type as well as define a more complex configuration.

**Describe the solution you'd like**
The idea would be to add these three parameters to the __init__ method of the PineconeDocumentStore

**Describe alternatives you've considered**
I think the proposed idea should be quite straightforward 

**Additional context**




Discussion:
Hey, this sounds like a good idea. As I see it we can only [pass already initialized indices](https://github.com/deepset-ai/haystack/blob/main/haystack/document_stores/pinecone.py#L75) to haystacks PineconeDocumentStore or it creates an index with default values. This is clearly suboptimal.

Do you want to create a small PR for this?
 
Hi @Timoeller! Unfortunately I don't think I would be able. I can take a look at it and see what comes out of it, but can't promise anything :)

Resolving patch:
diff --git a/haystack/document_stores/pinecone.py b/haystack/document_stores/pinecone.py
--- a/haystack/document_stores/pinecone.py
+++ b/haystack/document_stores/pinecone.py
@@ -79,6 +79,8 @@ def __init__(
         environment: str = "us-west1-gcp",
         pinecone_index: Optional["pinecone.Index"] = None,
         embedding_dim: int = 768,
+        pods: int = 1,
+        pod_type: str = "p1.x1",
         return_embedding: bool = False,
         index: str = "document",
         similarity: str = "cosine",
@@ -98,6 +100,8 @@ def __init__(
             regions are supported, contact Pinecone [here](https://www.pinecone.io/contact/) if required.
         :param pinecone_index: pinecone-client Index object, an index will be initialized or loaded if not specified.
         :param embedding_dim: The embedding vector size.
+        :param pods: The number of pods for the index to use, including replicas. Defaults to 1.
+        :param pod_type: The type of pod to use. Defaults to `"p1.x1"`.
         :param return_embedding: Whether to return document embeddings.
         :param index: Name of index in document store to use.
         :param similarity: The similarity function used to compare document vectors. `"cosine"` is the default
@@ -151,6 +155,8 @@ def __init__(
         self.duplicate_documents = duplicate_documents
 
         # Pinecone index params
+        self.pods = pods
+        self.pod_type = pod_type
         self.replicas = replicas
         self.shards = shards
         self.namespace = namespace
@@ -182,6 +188,8 @@ def __init__(
         else:
             self.pinecone_indexes[self.index] = self._create_index(
                 embedding_dim=self.embedding_dim,
+                pods=self.pods,
+                pod_type=self.pod_type,
                 index=self.index,
                 metric_type=self.metric_type,
                 replicas=self.replicas,
@@ -199,6 +207,8 @@ def _index(self, index) -> str:
     def _create_index(
         self,
         embedding_dim: int,
+        pods: int = 1,
+        pod_type: str = "p1.x1",
         index: Optional[str] = None,
         metric_type: Optional[str] = "cosine",
         replicas: Optional[int] = 1,
@@ -225,6 +235,8 @@ def _create_index(
                 pinecone.create_index(
                     name=index,
                     dimension=embedding_dim,
+                    pods=pods,
+                    pod_type=pod_type,
                     metric=metric_type,
                     replicas=replicas,
                     shards=shards,
@@ -254,6 +266,8 @@ def _index_connection_exists(self, index: str, create: bool = False) -> Optional
             if create:
                 return self._create_index(
                     embedding_dim=self.embedding_dim,
+                    pods=self.pods,
+                    pod_type=self.pod_type,
                     index=index,
                     metric_type=self.metric_type,
                     replicas=self.replicas,


Test patch:
diff --git a/test/document_stores/test_pinecone.py b/test/document_stores/test_pinecone.py
--- a/test/document_stores/test_pinecone.py
+++ b/test/document_stores/test_pinecone.py
@@ -38,11 +38,16 @@ def ds(self, monkeypatch, request) -> PineconeDocumentStore:
                 monkeypatch.setattr(f"pinecone.{fname}", function, raising=False)
             for cname, class_ in getmembers(pinecone_mock, isclass):
                 monkeypatch.setattr(f"pinecone.{cname}", class_, raising=False)
+        params = getattr(request, "param", {})
+        pods = params.get("pods", None)
+        pod_type = params.get("pod_type", None)
 
         return PineconeDocumentStore(
             api_key=os.environ.get("PINECONE_API_KEY") or "fake-pinecone-test-key",
             embedding_dim=768,
             embedding_field="embedding",
+            pods=pods,
+            pod_type=pod_type,
             index="haystack_tests",
             similarity="cosine",
             recreate_index=True,
diff --git a/test/mocks/pinecone.py b/test/mocks/pinecone.py
--- a/test/mocks/pinecone.py
+++ b/test/mocks/pinecone.py
@@ -45,6 +45,8 @@ def __init__(
         api_key: Optional[str] = None,
         environment: Optional[str] = None,
         dimension: Optional[int] = None,
+        pods: Optional[int] = None,
+        pod_type: Optional[str] = None,
         metric: Optional[str] = None,
         replicas: Optional[int] = None,
         shards: Optional[int] = None,
@@ -55,6 +57,8 @@ def __init__(
         self.environment = environment
         self.dimension = dimension
         self.metric = metric
+        self.pods = pods
+        self.pod_type = pod_type
         self.replicas = replicas
         self.shards = shards
         self.metadata_config = metadata_config
@@ -338,6 +342,8 @@ def create_index(
     dimension: int,
     metric: str = "cosine",
     replicas: int = 1,
+    pods: int = 1,
+    pod_type: str = "p1.x1",
     shards: int = 1,
     metadata_config: Optional[dict] = None,
 ):
@@ -348,6 +354,8 @@ def create_index(
         dimension=dimension,
         metric=metric,
         replicas=replicas,
+        pods=pods,
+        pod_type=pod_type,
         shards=shards,
         metadata_config=metadata_config,
     )