code
docs
tests
Index/Query services backed by ElasticSearch search engine built on top of Apache Lucene.
ElasticSearch does not support queries using regular expressions. It means that you can’t use MatchesSpecification from the Query API. See the ElasticSearch issue #988.
Three modes of operation are supported:
Table 80. Artifact
Group ID | Artifact ID | Version |
---|---|---|
org.qi4j.extension | org.qi4j.extension.indexing-elasticsearch | 2.0 |
Both in-memory and on-filesystem assemblies share the same configuration properties, see below.
In-memory ElasticSearch Index/Query service relies on the FileConfig Library to decide where it stores its transaction logs as there’s no in-memory transaction log implementation in ElasticSearch.
Assembly is done using the provided Assembler:
new ESMemoryIndexQueryAssembler().withConfigModule( configModule ).assemble( module );
Filesystem based ElasticSearch Index/Query service relies on the FileConfig Library to decide where it stores its index data, transaction logs etc…
Assembly is done using the provided Assembler:
new ESFilesystemIndexQueryAssembler().withConfigModule( configModule ).assemble( module );
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 both the in-memory and on-filesystem ElasticSearch Index/Query services:
public interface ElasticSearchConfiguration extends ConfigurationComposite { /** * Cluster name. * Defaults to 'qi4j_cluster'. */ @Optional Property<String> clusterName(); /** * Index name. * Defaults to 'qi4j_index'. */ @Optional Property<String> index(); /** * Set to true to index non aggregated associations as if they were aggregated. * WARN: Don't use this if your domain model contains circular dependencies. * Defaults to 'FALSE'. */ @UseDefaults Property<Boolean> indexNonAggregatedAssociations(); }
All configuration properties are defaulted meaning that you can use ElasticSearch Index/Query service without configuration.
Assembly is done using the provided Assembler:
new ESClusterIndexQueryAssembler().withConfigModule( configModule ).assemble( module );
Here are the configuration properties for the clustered ElasticSearch Index/Query service. Note that it inherits the properties defined in the in-memory or on-filesystem configuration, see above.
public interface ElasticSearchClusterConfiguration extends ElasticSearchConfiguration { /** * Coma separated list of nodes host:port. * Defaults to '127.0.0.1:9300'. */ @Optional Property<String> nodes(); /** * Allows client to sniff the rest of the cluster, and add those into its list of machines to use. * In this case, note that the ip addresses used will be the ones that the other nodes were started * with (the “publish” address). * Defaults to FALSE. */ @UseDefaults Property<Boolean> clusterSniff(); /** * Set to true to ignore cluster name validation of connected nodes. * Defaults to FALSE. */ @UseDefaults Property<Boolean> ignoreClusterName(); /** * The time to wait for a ping response from a node. * Defaults to 5s. */ @Optional Property<String> pingTimeout(); /** * How often to sample / ping the nodes listed and connected. * Defaults to 5s. */ @Optional Property<String> samplerInterval(); }
Again, all configuration properties are defaulted meaning that you can use ElasticSearch Index/Query service without configuration.