This page shows you how to target an index for data operations such as upsert and query.

Do not target an index by name in production.

When you target an index by name for data operations such as upsert and query, the SDK gets the unique DNS host for the index using the describe_index operation. This is convenient for testing but should be avoided in production because describe_index uses a different API than data operations and therefore adds an additional network call and point of failure. Instead, you should get an index host once and cache it for reuse or specify the host directly.

This method is recommended for production:

Get an index host

You can get the unique DNS host for an index from the Pinecone console or the Pinecone API.

To get an index host from the Pinecone console:

  1. Open the Pinecone console.
  2. Select the project containing the index.
  3. Select the index.
  4. Copy the URL under HOST.

To get an index host from the Pinecone API, use the describe_index operation, which returns the index host as the host value:

Target by index name

This method is convenient for testing but is not recommended for production: