younifyd
Menu

Search with text (legacy Records API)

Search with text (legacy Records API)

POST/records/namespaces/{namespace}/search

Use it in a workflow

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

Request

Path parameters

namespacestringrequired

The namespace to search.

Request body

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

queryobjectrequired

The query to search with. Set `top_k` and one of `inputs`, `vector`, or `id`.

top_kinteger (int32)required

The number of similar records to return, from 1 to 10000.

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).

inputsobject
vectorobject3 fields
idstring

The unique ID of the vector to be used as a query vector.

match_termsobject2 fields

Specifies which terms must be present in the text of each search hit based on the specified strategy. The match is performed against the text field specified in the legacy integrated index's `field_map` configuration. Terms are normalized and tokenized into single tokens before matching, and order does not matter. Example: `"match_terms": {"terms": ["animal", "CHARACTER", "donald Duck"], "strategy": "all"}` will tokenize to `["animal", "character", "donald", "duck"]`, and would match `"Donald F. Duck is a funny animal character"` but would not match `"A duck is a funny animal"`. Match terms filtering is supported only for sparse [legacy integrated indexes](https://docs.pinecone.io/guides/index-data/indexing-overview#vector-embedding) configured to use the [pinecone-sparse-english-v0](https://docs.pinecone.io/models/pinecone-sparse-english-v0) model.

fieldsarray<string>

The fields to return in the search results. If not specified, the response will include all fields.

rerankobject

Parameters for reranking the initial search results.

modelstringrequired

The name of the [reranking model](https://docs.pinecone.io/guides/search/rerank-results#reranking-models) to use.

rank_fieldsarray<string>required

The field(s) to consider for reranking. Every returned record must contain each listed field; otherwise the request is rejected with `400`. The number of fields supported is [model-specific](https://docs.pinecone.io/guides/search/rerank-results#reranking-models).

top_ninteger (int32)

The number of top results to return after reranking. Defaults to top_k.

parametersobject

Additional model-specific parameters. Refer to the [model guide](https://docs.pinecone.io/guides/search/rerank-results#reranking-models) for available model parameters.

querystring

The query to rerank documents against. If a specific rerank query is specified, it overwrites the query input that was provided at the top level. Required when the search uses `vector` or `id`, since there is no query text to rerank against; omitting it in that case is rejected with `400`.

json
{
  "query": {
    "top_k": 10,
    "filter": {},
    "inputs": {
      "text": "chunk_text"
    },
    "vector": {
      "values": [
        0
      ],
      "sparse_values": [
        0.1,
        0.2,
        0.3
      ],
      "sparse_indices": [
        10,
        3,
        156
      ]
    },
    "id": "example-vector-1",
    "match_terms": {
      "strategy": "all",
      "terms": [
        "animal",
        "CHARACTER",
        "donald Duck"
      ]
    }
  },
  "fields": [
    "chunk_text"
  ],
  "rerank": {
    "model": "bge-reranker-v2-m3",
    "rank_fields": [
      "chunk_text",
      "title"
    ],
    "top_n": 5,
    "parameters": {
      "truncate": "END"
    },
    "query": "What is the capital of France?"
  }
}

Response

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

resultobject
hitsarray<object>required3 fields

The hits for the search document request.

usageobject
read_unitsinteger (int32)required

The number of read units consumed by this operation.

egress_bytesinteger (int64)

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

embed_total_tokensinteger (int32)

The number of embedding tokens consumed by this operation.

rerank_unitsinteger (int32)

The number of rerank units consumed by this operation.

namespacestring

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

json
{
  "result": {
    "hits": [
      {
        "_id": "example-record-1",
        "_score": 0.9281134605407715,
        "fields": {
          "data": "your example text",
          "more_data": {
            "text": "your example text"
          }
        }
      }
    ]
  },
  "usage": {
    "read_units": 5,
    "egress_bytes": 1024,
    "embed_total_tokens": 2,
    "rerank_units": 1
  },
  "namespace": "example-namespace"
}

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