> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Elasticsearch point-in-time observations

> Read an Elasticsearch index with a point in time and search_after.

Mount `@bijectionhq/app-documents` once per concrete Elasticsearch 8.x
or later index. Use this installation with [installer-bound labels](https://docs.bijection.com/integrations/native-connectors.md#installer-bound-labels).

```ts bijection/app.ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { app, label, secret } from "@bijectionhq/bijection";
import documents, { elasticsearch } from "@bijectionhq/app-documents";

const catalog = label();
const reader = secret();
const search = elasticsearch("https://search.example.com", reader, catalog);

export default app({ catalog, reader, search, products: documents({ data: catalog, provider: search }) });
```

Grant `products.operator` and call `products.source.initialize` with:

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
{ selection: { mode: "elasticsearch", index: { index: "products", key: "sku" } } }
```

Read rows with `products.documents.list` and the source with
`products.source.health`.

Set the encoded Elasticsearch API key with `bijection secret set reader`. Grant it
read and PIT access only to the configured index. Use a concrete index name
and a unique, immutable top-level keyword field with doc values, no
normalizer, and the same string in `_source`. The key is limited to 384 bytes.

The app reads one hit per page, accepts up to 36 KiB of JSON per answer, and
commits each observation with the most recent PIT ID and complete sort array.
The PIT ID is limited to 2,600 bytes and its keep-alive is two minutes. The app
closes the PIT after the final page. The provider expires abandoned PITs.
A missing PIT stops advancement. Review `source.health` and use
`source.reset` with the revision and gap stamp to start a fresh pass.
Observations become visible page by page, and deletion by absence is
outside this mode.

[Elasticsearch PIT pagination](https://www.elastic.co/docs/reference/elasticsearch/rest-apis/paginate-search-results)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.