Skip to content

Commit 16cea5c

Browse files
committed
Add create index examples to README.md file.
1 parent a10bebe commit 16cea5c

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

README.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,33 @@ Or a specific development version:
2020
pip install git+https://[email protected]/pinecone-io/pinecone-python-client.git
2121
pip install git+https://[email protected]/pinecone-io/pinecone-python-client.git@example-branch-name
2222
pip install git+https://[email protected]/pinecone-io/pinecone-python-client.git@259deff
23-
```
23+
```
24+
25+
## Creating an index
26+
27+
The following example creates an index without a metadata
28+
configuration. By default, Pinecone indexes all metadata.
29+
30+
```python
31+
32+
import pinecone
33+
34+
35+
pinecone.init(api_key="YOUR_API_KEY",
36+
environment="us-west1-gcp")
37+
38+
pinecone.create_index("example-index", dimension=1024)
39+
```
40+
41+
The following example creates an index that only indexes
42+
the "color" metadata field. Queries against this index
43+
cannot filter based on any other metadata field.
44+
45+
```python
46+
metadata_config = {
47+
"indexed": ["color"]
48+
}
49+
50+
pinecone.create_index("example-index-2", dimension=1024,
51+
metadata_config=metadata_config)
52+
```

0 commit comments

Comments
 (0)