Class ElasticsearchBackendSettings


  • public final class ElasticsearchBackendSettings
    extends Object
    Configuration properties for Elasticsearch backends.

    Constants in this class are to be appended to a prefix to form a property key; see BackendSettings for details.

    Author:
    Gunnar Morling
    • Field Detail

      • TYPE_NAME

        public static final String TYPE_NAME
        The value to set the backend type configuration property in order to get an Elasticsearch backend instantiated by Hibernate Search.

        Only useful if you have more than one backend technology in the classpath; otherwise the backend type is automatically detected.

        See Also:
        Constant Field Values
      • HOSTS

        public static final String HOSTS
        The hostname and ports of the Elasticsearch servers to connect to.

        Expects a String representing a hostname and port such as localhost or es.mycompany.com:4400, or a String containing multiple such hostname-and-port strings separated by commas, or a Collection<String> containing such hostname-and-port strings.

        Multiple servers may be specified for load-balancing: requests will be assigned to each host in turns.

        Setting this property at the same time as URIS will lead to an exception being thrown on startup.

        Defaults to ElasticsearchBackendSettings.Defaults.HOSTS.

        See Also:
        Constant Field Values
      • URIS

        public static final String URIS
        The protocol, hostname and ports of the Elasticsearch servers to connect to.

        Expects either a String representing an URI such as http://localhost or https://es.mycompany.com:4400, or a String containing multiple such URIs separated by commas, or a Collection<String> containing such URIs.

        All the URIs must specify the same protocol.

        Setting this property at the same time as HOSTS or PROTOCOL will lead to an exception being thrown on startup.

        Defaults to http://localhost:9200, unless HOSTS or PROTOCOL are set, in which case they take precedence.

        See Also:
        Constant Field Values
      • VERSION

        public static final String VERSION
        The version of Elasticsearch running on the Elasticsearch cluster.

        Expects either an ElasticsearchVersion object, or a String that can be parsed in such an object.

        No default: if not provided, the version will be resolved automatically by sending a request to the Elasticsearch cluster on startup.

        See Also:
        Constant Field Values
      • USERNAME

        public static final String USERNAME
        The username to send when connecting to the Elasticsearch servers (HTTP authentication).

        Expects a String.

        Defaults to no username (anonymous access).

        See Also:
        Constant Field Values
      • PASSWORD

        public static final String PASSWORD
        The password to send when connecting to the Elasticsearch servers (HTTP authentication).

        Expects a String.

        Defaults to no username (anonymous access).

        See Also:
        Constant Field Values
      • REQUEST_TIMEOUT

        public static final String REQUEST_TIMEOUT
        The timeout when executing a request to an Elasticsearch server.

        This includes the time needed to establish a connection, send the request and read the response.

        Expects a positive Integer value in milliseconds, such as 60000, or a String that can be parsed into such Integer value.

        Defaults to no request timeout.

        See Also:
        Constant Field Values
      • THREAD_POOL_SIZE

        public static final String THREAD_POOL_SIZE
        The size of the thread pool assigned to the backend.

        Expects a strictly positive integer value, or a string that can be parsed into an integer value.

        See the reference documentation, section "Elasticsearch backend - Threads", for more information about this setting and its implications.

        Defaults to the number of processor cores available to the JVM on startup.

        See Also:
        Constant Field Values
      • MAX_KEEP_ALIVE

        public static final String MAX_KEEP_ALIVE
        How long connections to the Elasticsearch cluster can be kept idle.

        Expects a positive Long value of milliseconds, such as 60000, or a String that can be parsed into such Integer value.

        If the response from an Elasticsearch cluster contains a Keep-Alive header, then the effective max idle time will be whichever is lower: the duration from the Keep-Alive header or the value of this property (if set).

        If this property is not set, only the Keep-Alive header is considered, and if it's absent, idle connections will be kept forever.

        See Also:
        Constant Field Values
      • QUERY_SHARD_FAILURE_IGNORE

        public static final String QUERY_SHARD_FAILURE_IGNORE
        This property defines if partial shard failures are ignored.

        In case all shards fail, Elasticsearch cluster will return a 400 status code itself, but if only some of the shards fail, then the client will receive a successful partial response from the shards that were successful.

        To prevent getting any partial results this setting can be set to false. While if the partial failures should be ignored and considered as valid results then the value should be set to true.

        Expects a Boolean value such as true or false, or a string that can be parsed into a Boolean value.

        Defaults to ElasticsearchBackendSettings.Defaults.QUERY_SHARD_FAILURE_IGNORE.

        See Also:
        Constant Field Values