Reputation: 9368
I am using Azure AI Search.
In the Azure portal, I have an indexer with a 'Failed' status:
In my application, I retrieve the indexer's status using the following REST API call:
GET https://[service name].search.windows.net/indexers/[indexer name]/status?api-version=2024-07-01
as documented here:
I get this response:
Discrepancy: The REST API response differs from the Azure Portal's display. Specifically, as shown in my screenshot.
Question: How can I retrieve the indexer's status via the REST API to match the status displayed in the Azure Portal?
Could this be a bug in the REST API?
Upvotes: 0
Views: 93
Reputation: 8140
What you are checking is lastResult
which is the most recent run or in progress run will be returned.
In your case i can see it is success 2 mins ago and returned correct results via api also.
check this documentation for response definitions.
For checking all the run status, you extract executionHistory
from response.
Here is sample code for it.
headers = {"Context-Type": "text/json", "api-key": "PiVvxxxxxyyyyyy"}
response = requests.get(
url="https://<endpoint>/indexers('azureblob-indexer')/search.status?api-version=2024-07-01", headers=headers
)
for i in response.json()['executionHistory']:
print(i['status'])
Output:
and in portal
Upvotes: 0