From a8a43db4eb903e55e00de00bc9bcf5d9d9c5c6bf Mon Sep 17 00:00:00 2001 From: Mauricio Scheffer Date: Thu, 12 Dec 2024 18:00:56 +0000 Subject: [PATCH] Fix PIT example in search.md Signed-off-by: Mauricio Scheffer --- guides/search.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/guides/search.md b/guides/search.md index 2b015d0e..376dd14f 100644 --- a/guides/search.md +++ b/guides/search.md @@ -268,9 +268,9 @@ search_body = { } # create a point in time -pit = client.create_point_in_time( +pit = client.create_pit( index = 'movies', - keep_alive = '1m' + params = {'keep_alive': '1m'} ) # include pit info in the search body @@ -288,14 +288,12 @@ page_1 = client.search( size = 2, body = pit_search_body )['hits']['hits'] -pit_search_body.update({'search_after':page_1[-1]['sort']}) +pit_search_body.update({'size': 2, 'search_after':page_1[-1]['sort']}) page_2 = client.search( - size = 2, body = pit_search_body )['hits']['hits'] pit_search_body.update({'search_after':page_2[-1]['sort']}) page_3 = client.search( - size = 2, body = pit_search_body )['hits']['hits'] @@ -305,7 +303,7 @@ print([hit['_source']['title'] for hit in page_2]) print([hit['_source']['title'] for hit in page_3]) # delete the point in time -client.delete_point_in_time(body = { 'pit_id': pit['pit_id'] }) +client.delete_pit(body = { 'pit_id': pit['pit_id'] }) ``` ## Cleanup