younifyd
Menu

Search with a vector

Search with a vector

POST/query

Use it in a workflow

  1. Add a step and choose the Pinecone connector.
  2. Pick the Search with a vector action (under Data).
  3. Fill in the fields below, then reference the result from later steps as {{searchWithAVector.response.data}}.

Request

Request body

Enter the body as JSON in the step's Body field.

namespacestring

The namespace to query.

topKinteger (int64)required

The number of results to return for each query.

filterobject

The filter to apply. You can use vector metadata to limit your search. See [Understanding metadata](https://docs.pinecone.io/guides/index-data/indexing-overview#metadata).

includeValuesboolean

Indicates whether vector values are included in the response. For on-demand indexes, setting this to `true` may increase latency, especially with higher `topK` values, because vector values are retrieved from object storage. Unless you need vector values, set this to `false` for better performance.

Default false

includeMetadataboolean

Indicates whether metadata is included in the response as well as the ids.

Default false

vectorarray<number (float)>

The query vector. This should be the same length as the dimension of the index being queried. Each `query` request can contain only one of the parameters `id` or `vector`. Whether `vector` and `sparseVector` may be sent together depends on the index: an index that supports only a single query predicate rejects the combination.

sparseVectorobject

Vector sparse data. Represented as a list of indices and a list of corresponded values, which must be with the same length.

indicesarray<integer (int64)>required

The indices of the sparse data.

valuesarray<number (float)>required

The corresponding values of the sparse data, which must be with the same length as the indices.

idstring

The unique ID of the vector to be used as a query vector. It is mutually exclusive with both vector forms: a request naming `id` may not also carry `vector` or `sparseVector`.

scanFactornumber (float)

An optimization parameter for IVF dense indexes in dedicated read node indexes. It adjusts how much of the index is scanned to find vector candidates. Range: 0.5 – 4 (default). Keep the default (4.0) for the best search results. If query latency is too high, try lowering this value incrementally (minimum 0.5) to speed up the search at the cost of slightly lower accuracy. This parameter is only supported for dedicated (DRN) dense indexes.

maxCandidatesinteger (int64)

An optimization parameter that controls the maximum number of candidate dense vectors to rerank. Reranking computes exact distances to improve recall but increases query latency. Range: top_k – 100000. Keep the default for a balance of recall and latency. Increase this value if recall is too low, or decrease it to reduce latency at the cost of accuracy. This parameter is only supported for dedicated (DRN) dense indexes.

json
{
  "topK": 10,
  "namespace": "example-namespace",
  "filter": {
    "genre": {
      "$in": [
        "comedy",
        "documentary",
        "drama"
      ]
    },
    "year": {
      "$eq": 2019
    }
  },
  "includeValues": true,
  "includeMetadata": true,
  "vector": [
    0.1,
    0.2,
    0.3,
    0.4,
    0.5,
    0.6,
    0.7,
    0.8
  ],
  "sparseVector": {
    "indices": [
      1,
      312,
      822,
      14,
      980
    ],
    "values": [
      0.1,
      0.2,
      0.3,
      0.4,
      0.5
    ]
  },
  "id": "example-vector-1",
  "scanFactor": 2,
  "maxCandidates": 1000
}

Response

Returns 200 with an object. Read it in later steps with {{searchWithAVector.response.data.<field>}}.

resultsarray<object>

DEPRECATED. The results of each query. The order is the same as `QueryRequest.queries`.

matchesarray<object>5 fields

The matches for the vectors.

namespacestring

The namespace for the vectors.

matchesarray<object>

The matches for the vectors.

idstringrequired

This is the vector's unique id.

scorenumber (float)

This is a measure of similarity between this vector and the query vector. The higher the score, the more they are similar.

valuesarray<number (float)>

This is the vector data, if it is requested.

sparseValuesobject2 fields

Vector sparse data. Represented as a list of indices and a list of corresponded values, which must be with the same length.

metadataobject

This is the metadata, if it is requested.

namespacestring

The namespace that served the query: the request's namespace, or the alias's target namespace when the request named a namespace alias.

usageobject
readUnitsinteger (int64)

The number of read units consumed by this operation.

egressBytesinteger (int64)

The billed egress for this response, in bytes. Measured on the encoded response payload.

json
{
  "results": [
    {
      "matches": [
        {
          "id": "example-vector-1",
          "score": 0.08,
          "values": [
            0.1,
            0.2,
            0.3,
            0.4,
            0.5,
            0.6,
            0.7,
            0.8
          ],
          "sparseValues": {
            "indices": [
              1,
              312,
              822,
              14,
              980
            ],
            "values": [
              0.1,
              0.2,
              0.3,
              0.4,
              0.5
            ]
          },
          "metadata": {
            "genre": "documentary",
            "year": 2019
          }
        }
      ],
      "namespace": "example-namespace"
    }
  ],
  "matches": [
    {
      "id": "example-vector-1",
      "score": 0.08,
      "values": [
        0.1,
        0.2,
        0.3,
        0.4,
        0.5,
        0.6,
        0.7,
        0.8
      ],
      "sparseValues": {
        "indices": [
          1,
          312,
          822,
          14,
          980
        ],
        "values": [
          0.1,
          0.2,
          0.3,
          0.4,
          0.5
        ]
      },
      "metadata": {
        "genre": "documentary",
        "year": 2019
      }
    }
  ],
  "namespace": "string",
  "usage": {
    "readUnits": 5,
    "egressBytes": 1024
  }
}

Need more? See the Pinecone guide for connection setup and behaviour shared by every action.