o
    gZhb                     @   sH   d dl Zd dlmZ ddlmZ ddlmZmZm	Z	 G dd deZ
dS )    N)ObjectApiResponse   )NamespacedClient)SKIP_IN_PATH_quote_rewrite_parametersc                   @   s  e Zd Zeddddddddddddd
dejeeje f dejej	eej
f  dejej	eej
f  deje d	ejejeeje f  d
eje deje dejej	eej
f  deje dejejddef  dejejej	eej
f   deej
 fddZdS )GraphClientT)Zbody_fieldsN)
connectionscontrolserror_tracefilter_pathhumanprettyqueryroutingtimeoutverticesindexr	   r
   r   r   r   r   r   r   r   zt.Literal[-1]zt.Literal[0]r   returnc                   s  |t v r	tddt| d}i }i }|dur||d< |dur%||d< |dur-||d< |dur5||d< |dur=||d	< |durE||d
< |durM||d< |	durU|	|d< |
dur]|
|d< |dure||d< |sid}ddi}|durud|d< | jd||||dI dH S )a   
        Explore extracted and summarized information about the documents and terms in
        an index.

        `<https://www.elastic.co/guide/en/elasticsearch/reference/8.11/graph-explore-api.html>`_

        :param index: Name of the index.
        :param connections: Specifies or more fields from which you want to extract terms
            that are associated with the specified vertices.
        :param controls: Direct the Graph API how to build the graph.
        :param query: A seed query that identifies the documents of interest. Can be
            any valid Elasticsearch query.
        :param routing: Custom value used to route operations to a specific shard.
        :param timeout: Specifies the period of time to wait for a response from each
            shard. If no response is received before the timeout expires, the request
            fails and returns an error. Defaults to no timeout.
        :param vertices: Specifies one or more fields that contain the terms you want
            to include in the graph as vertices.
        z(Empty value passed for parameter 'index'/z/_graph/exploreNr	   r
   r   r   r   r   r   r   r   r   acceptzapplication/jsonzcontent-typePOST)paramsheadersbody)r   
ValueErrorr   Zperform_request)selfr   r	   r
   r   r   r   r   r   r   r   r   Z_GraphClient__pathZ_GraphClient__bodyZ_GraphClient__queryZ_GraphClient__headers r   X/var/www/html/lang_env/lib/python3.10/site-packages/elasticsearch/_async/client/graph.pyexplore   sD   %
zGraphClient.explore)__name__
__module____qualname__r   tUnionstrSequenceOptionalMappingAnyboolr   r   r   r   r   r   r      sN    	
r   )typingr#   Zelastic_transportr   _baser   utilsr   r   r   r   r   r   r   r   <module>   s
   