def clear_cached_realms(
        self,
        *,
        realms: t.Union[str, t.Sequence[str]],
        error_trace: t.Optional[bool] = None,
        filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
        human: t.Optional[bool] = None,
        pretty: t.Optional[bool] = None,
        usernames: t.Optional[t.Sequence[str]] = None,
    ) -> ObjectApiResponse[t.Any]:
        """
        .. raw:: html

          <p>Clear the user cache.</p>
          <p>Evict users from the user cache.
          You can completely clear the cache or evict specific users.</p>
          <p>User credentials are cached in memory on each node to avoid connecting to a remote authentication service or hitting the disk for every incoming request.
          There are realm settings that you can use to configure the user cache.
          For more information, refer to the documentation about controlling the user cache.</p>


        `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-security-clear-cached-realms>`_

        :param realms: A comma-separated list of realms. To clear all realms, use an
            asterisk (`*`). It does not support other wildcard patterns.
        :param usernames: A comma-separated list of the users to clear from the cache.
            If you do not specify this parameter, the API evicts all users from the user
            cache.
        """
        if realms in SKIP_IN_PATH:
            raise ValueError("Empty value passed for parameter 'realms'")
        __path_parts: t.Dict[str, str] = {"realms": _quote(realms)}
        __path = f'/_security/realm/{__path_parts["realms"]}/_clear_cache'
        __query: t.Dict[str, t.Any] = {}
        if error_trace is not None:
            __query["error_trace"] = error_trace
        if filter_path is not None:
            __query["filter_path"] = filter_path
        if human is not None:
            __query["human"] = human
        if pretty is not None:
            __query["pretty"] = pretty
        if usernames is not None:
            __query["usernames"] = usernames
        __headers = {"accept": "application/json"}
        return self.perform_request(  # type: ignore[return-value]
            "POST",
            __path,
            params=__query,
            headers=__headers,
            endpoint_id="security.clear_cached_realms",
            path_parts=__path_parts,
        )

        .. raw:: html

          <p>Clear the user cache.</p>
          <p>Evict users from the user cache.
          You can completely clear the cache or evict specific users.</p>
          <p>User credentials are cached in memory on each node to avoid connecting to a remote authentication service or hitting the disk for every incoming request.
          There are realm settings that you can use to configure the user cache.
          For more information, refer to the documentation about controlling the user cache.</p>


        `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-security-clear-cached-realms>`_

        :param realms: A comma-separated list of realms. To clear all realms, use an
            asterisk (`*`). It does not support other wildcard patterns.
        :param usernames: A comma-separated list of the users to clear from the cache.
            If you do not specify this parameter, the API evicts all users from the user
            cache.
        
elasticsearch/_sync/client/security.py