Can PIT ID change when using point in time for pagination?


I have a question regarding search_after pagination using point in time.

The search request for each page also returns the PIT ID. Can the PIT ID change, i.e. do I need to use the PIT ID from the previous response to make the request for the next page?

And if the PIT ID can actually change: what would happen if I made a search request with the old PIT ID instead of the new one? E.g. HTTP 400 response etc…

In the ElasticSearch documentation this case is explicitly mentioned:

The open point in time request and each subsequent search request can return different id; thus always use the most recently received id for the next search request.

In the OpenSearch documentation it’s not as clear to me.

Thanks for your advice!

If I understand it correctly, the PIT would follow a search. So as long as you paginate from that same search, you should use the same PIT ID. Which is (I think) why you can manage PITs with the API: Point in Time API - OpenSearch Documentation

I’m not sure the PIT follows one particular search query, to me it sounds like a PIT ID can be used in multiple independent searches. I found this design proposal on the OpenSearch Github that says:

The Create PIT API returns a PIT Id. This PIT ID can be used as part of multiple search queries to get results on that view of data.

But the design proposal does sound like the PIT ID never changes:

To get the next page of 10000 results, user can rerun the previous search using the last doc’s sort values as the search_after argument. The search’s query and sort and pit.Id
arguments must remain unchanged.

That would indicate that in the response of a search request OpenSearch wouldn’t suddenly return a new PIT ID.

I am maybe also confused how ElasticSearch PIT and OpenSearch PIT are related. I thought that since OpenSearch is a fork, the PIT implementation is the same/similar, so I wonder why ElasticSearch can return a different PIT ID, while OpenSearch doesn’t…
But since there is this design proposal in the OpenSearch Github, maybe the implementations are independent?

Ah, right, it’s not tied to a search, I always confuse PIT with scroll :see_no_evil:

I think implementations are independent, yes.