---
title: "Opensearch Search"
method: POST
path: "/opensearch/search"
tags: ["OpenSearch"]
---

# Opensearch Search

`POST /opensearch/search`

## Request

- Base URL: `https://be.graph8.com/api/v1`
- URL: `https://be.graph8.com/api/v1/opensearch/search`
- Auth: HTTP bearer

Structured search across one of the whitelisted mashup OpenSearch indices.

Use this when the LLM needs to look up enriched person / company records
by attribute (domain, industry, country, hem). For the hot HEM-or-IP
resolve path, prefer ``/opensearch/resolve`` — it's a single round trip
and friendlier to cache. Contact/company mashup searches automatically
apply the authenticated organization's deliverability protection policy.

## Headers

- `Authorization` string, nullable
- `X-Target-Org-Id` string, nullable

## Request body

- OpenSearchSearchRequest
  - `index` 'mashup_contacts' | 'mashup_companies' | 'hem2contact' | 'ip2company', required: Logical index to search. Maps to a whitelisted physical alias.
  - `filters` object: Field equality filters. Scalar value -> term, list -> terms (OR). Use this to narrow by COMPANY_DOMAIN, COMPANY_INDUSTRY, hem, etc. Field names are the RAW index fields (UPPERCASE, e.g. COMPANY_INDUSTRY) -- not the friendly snake_case names used by /search.
  - `fields` string[], nullable: Optional projection. If omitted, returns the full _source. Pass a list to reduce payload size when the LLM only needs a few columns.
  - `sort` object[], nullable: Optional sort, list of `{field: 'asc'|'desc'}`. Required if you intend to paginate via cursor.
  - `limit` integer: Hard-capped at 200.
  - `cursor` unknown[], nullable: search_after token returned from a prior page. Pair with `sort`.
    - unknown
  - `track_total_hits` integer, nullable: Exact-count ceiling for the returned `total`. OMIT for the default behaviour (OpenSearch saturates `total` at 10000). Pass an integer ceiling 1-1000000 (e.g. 100000) to get an exact `total` up to that bound in the SAME round trip as the page. For a count with no page payload prefer POST /opensearch/count. Does NOT lift the from+size pagination depth -- use `cursor` (search_after) for that. (0 is rejected: it would mean 'disable tracking' in OpenSearch, which is what omitting it does.)

## Response `200`

Successful Response

- ApiResponseOpenSearchSearchResponse
  - `data` OpenSearchSearchResponse, required
    - `index` string, required
    - `total` integer
    - `hits` OpenSearchHit[]
      - `id` string, required
      - `score` number, nullable
      - `source` object
      - `sort` unknown[], nullable
        - unknown
    - `cursor` unknown[], nullable
      - unknown
    - `took_ms` integer
  - `pagination` PaginationMeta
    - `page` integer, required: Current page number (1-indexed)
    - `limit` integer, required: Items per page
    - `total` integer, required: Total number of items
    - `has_next` boolean, required: Whether there are more pages
    - `next_cursor` string, nullable: Opaque cursor for the next page; null when there are no more items. Pass it back as the `cursor` query param to fetch the following page without computing page numbers.
    - `total_available` integer, nullable: Search endpoints only: how many records really match, when known. Can be larger than `total`, which is capped at the 10,000 results that can be paged. For company search this is a distinct-company estimate. Null when unknown; absent outside search.
    - `total_is_lower_bound` boolean, nullable: Search endpoints only: true when more records match than `total` shows (the result set is larger than the 10,000 results that can be paged). Absent outside search.
    - `notes` string[], nullable: Search endpoints only: plain-language notes about the result, e.g. that more records match than can be paged, or that a reversed `between` range was put in order.

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/graph8/apis/graph8-developer-api.md) · [All operations](https://skmtc.dev/graph8/apis/graph8-developer-api/llms.txt) · [OpenAPI document](https://skmtc.dev/graph8/apis/graph8-developer-api/revisions/2e7cfa0ca921?raw)
