///////////////////////////////////////////////////////////////
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
///////////////////////////////////////////////////////////////

[[extension-index-elasticsearch,ElasticSearch Index/Query]]
= ElasticSearch Index/Query =


[devstatus]
--------------
source=extensions/indexing-elasticsearch/dev-status.xml
--------------


Index/Query services backed by http://www.elasticsearch.org/[ElasticSearch] search engine built on top of
http://lucene.apache.org/[Apache Lucene].

WARNING: ElasticSearch Index/Query do not support ComplexQueries from the Query API, ie. queries by "example value".

Three modes of operation are supported:

- embedded local only filesystem based node ;
- managed cluster client ;
- with a provided client.

In any case, Lucene hard limits apply.
See the https://lucene.apache.org/core/6_1_0/core/org/apache/lucene/codecs/lucene60/package-summary.html#Limitations[Lucene File Format]
documentation about maximum index size and document count.
Moreover, each field cannot be larger than 32766 bytes in its serialized form.

include::../../build/docs/buildinfo/artifact.txt[]

== Embedded on local file system ==

Filesystem based ElasticSearch Index/Query service relies on the <<library-fileconfig>> to decide where it stores its
index data, transaction logs etc...

Assembly is done using the provided Assembler:

[snippet,java]
----
source=extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/DocumentationSupport.java
tag=filesystem
----

=== Configuration ===

IMPORTANT: By default queries can only traverse Aggregated Associations, if you want to be able to traverse all
Associations set the `indexNonAggregatedAssociations` configuration property to `TRUE`.

Here are the configuration properties for the filesystem ElasticSearch Index/Query services:

[snippet,java]
----
source=extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchConfiguration.java
tag=config
----

All configuration properties are defaulted meaning that you can use ElasticSearch Index/Query service without
configuration.

== In an ElasticSearch cluster ==

=== Assembly ===

Assembly is done using the provided Assembler:

[snippet,java]
----
source=extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/DocumentationSupport.java
tag=cluster
----


=== Configuration ===

Here are the configuration properties for the clustered ElasticSearch Index/Query service. Note that it inherits the
properties defined in the filesystem configuration, see above.

[snippet,java]
----
source=extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchClusterConfiguration.java
tag=config
----

Again, all configuration properties are defaulted meaning that you can use ElasticSearch Index/Query service without
configuration.

== Using a provided client ==

=== Assembly ===

Assembly is done using the provided Assembler:

[snippet,java]
----
source=extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/DocumentationSupport.java
tag=client
----


=== Configuration ===

Here are the configuration properties for the ElasticSearch Index/Query service using a provided client.
Note that the `clusterName` is ignored as this is managed by the client.

[snippet,java]
----
source=extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchConfiguration.java
tag=config
----

Again, all configuration properties are defaulted meaning that you can use ElasticSearch Index/Query service without
configuration.
