What if your search results changed while you were still looking? Discover how to freeze time for your data!
Why Point-in-time API in Elasticsearch? - Purpose & Use Cases
Imagine you are searching through a huge library of books that keeps getting new books added or old ones removed while you are reading. You want to make sure your search results stay consistent, but the library keeps changing.
Without a special tool, your search results might change mid-way because the library updates. This makes your data unreliable and can cause confusion or errors when you try to analyze or display results.
The Point-in-time API lets you take a snapshot of the library at a specific moment. This way, all your searches use the same stable view, even if the library changes later. It keeps your results consistent and trustworthy.
search index=mybooks query='author:John' scroll=1m search index=mybooks query='title:Adventure' scroll=1m
pit = open_point_in_time(index='mybooks', keep_alive='1m') search index='mybooks' pit=pit id=pit['id'] query='author:John' search index='mybooks' pit=pit id=pit['id'] query='title:Adventure' close_point_in_time(id=pit['id'])
It enables you to perform multiple related searches with a consistent snapshot of data, ensuring accuracy and reliability in dynamic environments.
A news website uses Point-in-time API to show consistent search results to users while new articles are being published, so readers see stable and accurate information during their session.
Manual searches can return inconsistent results if data changes during queries.
Point-in-time API creates a stable snapshot for consistent searching.
This leads to reliable, repeatable search results even in changing data.