Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify Atlas Search Index exists #6

Open
wbleonard opened this issue Dec 7, 2023 · 1 comment
Open

Verify Atlas Search Index exists #6

wbleonard opened this issue Dec 7, 2023 · 1 comment

Comments

@wbleonard
Copy link
Contributor

A very obscure exception occurs if the Atlas Search index doesn't exist.

OperationFailure: PlanExecutor error during aggregation :: caused by :: Error connecting to localhost:28000 (127.0.0.1:28000) :: caused by :: Connection refused, full error: {'ok': 0.0, 'errmsg': 'PlanExecutor error during aggregation :: caused by :: Error connecting to localhost:28000 (127.0.0.1:28000) :: caused by :: Connection refused', 'code': 6, 'codeName': 'HostUnreachable', '$clusterTime': {'clusterTime': Timestamp(1701962312, 7), 'signature': {'hash': b'\xb7Fx\xee\x01L\xa4%\xbb\r\x8d\x9f\x04\x8b\xbcW\x07\xa9\x8f\xee', 'keyId': 7306191798055993350}}, 'operationTime': Timestamp(1701962312, 7)}

Either validate it exists OR catch the exception and provide a clearer response.

@ranfysvalle02
Copy link
Owner

ranfysvalle02 commented Dec 7, 2023

To list all Atlas Search indexes using Python, you can use the Atlas Search API or the Atlas UI. Here are the steps to list all Atlas Search indexes using the Atlas Search API:

  • First, you need to create an API key with the appropriate permissions to access the Atlas Search API. You can do this by following the instructions in the Atlas documentation.

  • Once you have created an API key, you can use it to authenticate your requests to the Atlas Search API. You can find more information on how to authenticate your requests in the Atlas documentation.

  • To list all Atlas Search indexes, you can use the GET /groups/{GROUP-ID}/clusters/{CLUSTER-NAME}/ftsIndexes endpoint of the Atlas Search API. You will need to replace {GROUP-ID} with your Atlas group ID and {CLUSTER-NAME} with the name of your Atlas cluster. You can find more information on how to use this endpoint in the Atlas documentation.

I would probably consider this as a 'nice to have'. Unfortunately I cannot list Atlas search indexes from the MongoDB Python driver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants