Interface ElasticSearchClient<T extends ElasticSearchClient>

  • All Superinterfaces:
    AutoCloseable, Closeable
    All Known Implementing Classes:
    ElasticSearchNativeClient

    public interface ElasticSearchClient<T extends ElasticSearchClient>
    extends Closeable

    This is the contract for a JBoss Dashbuilder REST client for ElasticSearch servers.

    Default ElasticSearch native client implementation is provided by classes in package org.dashbuilder.dataprovider.backend.elasticsearch.rest.impl

    You can implement your own client too.

    • Method Detail

      • serverURL

        T serverURL​(String serverURL)
        Builds the client for a given serer URL.
        Parameters:
        serverURL - The ElasticSearch server URL.
        Returns:
        The REST client for the given server URL.
      • index

        T index​(String... indexes)
        Builds the client for a given index/es.
        Parameters:
        indexes - The ElasticSearch index/es.
        Returns:
        The REST client for the given index/es.
      • type

        T type​(String... types)
        Builds the client for a given types/es.
        Parameters:
        types - The ElasticSearch types/es.
        Returns:
        The REST client for the given types/es.
      • clusterName

        T clusterName​(String clusterName)
        Builds the client for a given cluster.
        Parameters:
        clusterName - The ElasticSearch cluster name.
        Returns:
        The REST client for the given cluster.
      • setTimeout

        T setTimeout​(int timeout)
        Sets the timeout value for the HTTP rest client requests.
        Parameters:
        timeout - The timeout value in miliseconds.
      • count

        CountResponse count​(String[] index,
                            String[] type)
                     throws ElasticSearchClientGenericException
        Count documents for a given index/es and type/es
        Parameters:
        index - The index/es for the document type to count. If value is null returns the count number of all documents if all indexes.
        type - The type/s of the documents to count. If value is null returns the count number of all documents in all indexes or in the index specified by index.
        Returns:
        The number of documents for a given index/es and type/es
        Throws:
        ElasticSearchClientGenericException
      • search

        SearchResponse search​(org.dashbuilder.dataset.def.ElasticSearchDataSetDef definition,
                              org.dashbuilder.dataset.DataSetMetadata metadata,
                              SearchRequest searchRequest)
                       throws ElasticSearchClientGenericException

        Obtain documents for a given index/es and type/es

        If the index/es value set in the request is null returns all documents of all indexes.

        If the type/s value set in the request is null returns all documents in all indexes or in the index specified by index.

        Parameters:
        definition - The dataset definition.
        metadata - The metadata.
        searchRequest - The search request.
        Returns:
        The number of documents for a given index/es and type/es
        Throws:
        ElasticSearchClientGenericException