6

I'm trying to use the search_after parameter with a point in time (PIT) to paginate search results. This is the documentation section I'm consulting.

I'm making a POST to /my-index/_pit?keep_alive=1m.
The /_pit endpoint only accepts the POST method (if I try GET, it says only POST is accepted), and per the doc, does not take a request body. However, the response I receive is a 400 with this message:

"type": "parse_exception",
"reason": "request body is required"

I can't find any other examples of a /_pit request and I'm just confused by these responses.
Has anyone successfully gotten back a PIT?

In case it's relevant, we have a managed elastic cloud deployment on a standard subscription.

ChiefMcFrank
  • 721
  • 4
  • 18

2 Answers2

6

I ended up finding an Elastic forum post indicating that the PIT API is only available as of version 7.10. Sure enough, I tried against a 7.10 deployment and it succeeded as a POST without a body.

ChiefMcFrank
  • 721
  • 4
  • 18
  • 2
    Can you share the the link for that elastic search forum. Is this PIT Api only available on 7.10? I'm using 7.40 and still getting the same error – manojchowdary27 Mar 24 '21 at 12:56
  • 1
    @manojchowdary27 I unfortunately don't have that link handy anymore, and I was pretty deep into the search results when I found it. But in case this might be relevant to you, it appears PIT isn't available in oss distributions of any version - https://github.com/elastic/elasticsearch/issues/65906 – ChiefMcFrank Mar 25 '21 at 05:21
0

So, I feel as though there isn't much guidance on this outside of this particular example and I felt the need to post this for other users that struggled as I did.

If you're using an API tool like postman, you have to update your headers to include Content_Type: application/json, and set your authorization method as what you need (I used basic for password and username).

The index that you should use (my-index-000001 from their example) should be one that you've set up for your search query (right before the _search portion). Leave the body empty and send over the post request and you'll get your id.

JoshG
  • 31
  • 4