OpenSearch
Although we don’t interact with the OpenSearch cluster directly during day-to-day tasks, there are instances where this is necessary, such as when manually deleting a person added to the system in error.
Below are some useful commands for querying and interacting with the persons index.
Using Curl to interact with OpenSearch
OpenSearch is exposed on localhost:9200
locally and bound to $SEARCH
in the Cloud9 setup.sh
script. We can use this to interact with the persons that have been indexed as follows:
(Note id
in the below queries refers to the api database id)
Query by search criteria
curl -XGET $SEARCH/person/_search?q=<search_term>
More Involved Search and Deletion Process
Search for Order reference in Person Index, this will return all persons associated with this order/case
curl -X POST $SEARCH/person/_search?pretty \
-H "Content-Type: application/json" \
--data @search_searchable.json
search_searchable.json
{
"query": {
"match": {
"searchable": "7009-7493-0674"
}
}
}
Search by Client ID, this should retrieve a specific person
curl -X POST $SEARCH/person/_search?pretty \
-H "Content-Type: application/json" \
--data @search_uId.json
search_uId.json
{
"query": {
"match": {
"uId": "7009-7493-0666"
}
}
}
Get internal document ID field (_id) from response (this is also the database person id)
Check that returns the document you want
curl -X GET $SEARCH/person/_doc/60454479?pretty
Delete the document if it the one you want.
curl -X DELETE $SEARCH/person/_doc/60454479?pretty
This page was last reviewed on 16 April 2024.
It needs to be reviewed again on 16 October 2024
by the page owner #opg-sirius-develop
.
This page was set to be reviewed before 16 October 2024
by the page owner #opg-sirius-develop.
This might mean the content is out of date.