Description
Description
When the synonyms system index is first created via the first update via the Synonyms API, there's the possibility that the operation returns before the index is ready for search.
For example, in serverless it's possible that read shards have not been replicated yet from the index shards. That can cause an error if the Synonyms API is invoked afterwards, as there would be no read shards available and thus the request would fail.
It would be good to check that the synonyms index is readable before returning to the user when an update operation is requested. That way, ES can do some timed wait on the index being available when it receives back a 503.
We could put this as a separate option similar to wait_for_completion
, although that could be misleading - the Synonyms API already waits for the analyzers to be reloaded. As this is an API that is not expecting heavy updates, it could be enough with waiting for a default (or configurable) timeout when an update happens to ensure the synonyms system index is searchable.
Related - #121180