o
    gZhV                     @   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                C   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r4||d< |dur<||d	< |durD||d
< |durL||d< |	durT|	|d< |
dur\|
|d< |durd||d< |shd}ddi}|durtd|d< | jd||||d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   W/var/www/html/lang_env/lib/python3.10/site-packages/elasticsearch/_sync/client/graph.pyexplore   sB   %
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
   