From 2af2f0304a7fee568f6c542849d7482f0df4e5a2 Mon Sep 17 00:00:00 2001 From: MZhu9 <ujr7dj3ljx3fpstxflyytui5kziqgnbscv3po6mrm3ikbn52frqq> Date: Mon, 5 Jun 2023 09:11:35 -0500 Subject: [PATCH] add tutorial --- docs/tutorial/IndexerService.md | 56 ++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/docs/tutorial/IndexerService.md b/docs/tutorial/IndexerService.md index b6d8e858e..f63d8c725 100644 --- a/docs/tutorial/IndexerService.md +++ b/docs/tutorial/IndexerService.md @@ -115,7 +115,9 @@ This endpoint takes information from files, generated by `spring-boot-maven-plug ### Reindex <a name="reindex"></a> -Reindex API allows users to re-index a `kind` without re-ingesting the records via storage API. Reindexing a kind is an asynchronous operation and when a user calls this API, it will respond with HTTP 200 if it can launch the re-indexing or +#### Reindex a 'kind' + +Reindex kind API allows users to re-index a `kind` without re-ingesting the records via storage API. Reindexing a kind is an asynchronous operation and when a user calls this API, it will respond with HTTP 200 if it can launch the re-indexing or appropriate error code if it cannot. The current status of the indexing can be tracked by calling search API and making query with this particular kind. Please be advised, it may take few seconds to few hours to finish the re-indexing as multiple factors contribute to latency, such as number of records in the kind, current load at the indexer service etc. @@ -159,6 +161,58 @@ will use the same schema and overwrite records with the same ids. Default value `kind` <br />   (required, String) Kind to be re-indexed. +#### Reindex given records + +Reindex records API allows users to re-index the given records by providing the record ids without re-ingesting the records via storage API. Reindexing a kind is an asynchronous operation and when a user calls this API, it will respond with HTTP 202 if it can launch the re-indexing or +appropriate error code if it cannot. The response body indicates which given records were re-indexed and which ones were not found in storage. It supports up to 1000 records per API call. + +#### Request + +```http +POST /api/indexer/v2/reindex/records HTTP/1.1 +{ + "recordIds": ["opendes:work-product-component--WellLog:17763fcc18864f4f8eab62e320f8913d", "opendes:work-product-component--WellLog:566edebc-1a9f-4f4d-9a30-ed458e959ac7"] +} +``` + +<details><summary>**Curl**</summary> + +```bash +curl --request POST \ + --url '/api/indexer/v2/reindex/records' \ + --header 'accept: application/json' \ + --header 'authorization: Bearer <JWT>' \ + --header 'content-type: application/json' \ + --header 'data-partition-id: opendes' \ + --data '{ + "recordIds": ["opendes:work-product-component--WellLog:17763fcc18864f4f8eab62e320f8913d", "opendes:work-product-component--WellLog:566edebc-1a9f-4f4d-9a30-ed458e959ac7"] +}' +``` + +</details><br> + +#### Prerequisite + +Users must be a member of `users.datalake.admins` or `users.datalake.ops` group. + +#### Request body + +`recordIds` <br /> +  (required, Array of String) Storage records to be re-indexed. + +#### Example response + +```json +{ + "reIndexedRecords": [ + "opendes:work-product-component--WellLog:566edebc-1a9f-4f4d-9a30-ed458e959ac7" + ], + "notFoundRecords": [ + "opendes:work-product-component--WellLog:17763fcc18864f4f8eab62e320f8913d" + ] +} +``` + [Back to table of contents](#TOC) ## Delete API <a name="delete"></a> -- GitLab