ZEST-177 ElasticSearch 2.x does not support in-memory indices See https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking_20_setting_changes.html#_in_memory_indices
Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/04b74f21 Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/04b74f21 Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/04b74f21 Branch: refs/heads/develop Commit: 04b74f213ec280302dda9c9658959086c3f357a1 Parents: ea9da41 Author: Paul Merlin <[email protected]> Authored: Sun Sep 25 02:27:14 2016 +0200 Committer: Paul Merlin <[email protected]> Committed: Sun Sep 25 02:27:14 2016 +0200 ---------------------------------------------------------------------- .../src/docs/index-elasticsearch.txt | 29 ++----- .../assembly/ESMemoryIndexQueryAssembler.java | 51 ----------- .../memory/ESMemoryIndexQueryService.java | 32 ------- .../elasticsearch/memory/ESMemorySupport.java | 90 -------------------- .../index/elasticsearch/memory/package.html | 24 ------ .../elasticsearch/DocumentationSupport.java | 5 -- 6 files changed, 5 insertions(+), 226 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/04b74f21/extensions/indexing-elasticsearch/src/docs/index-elasticsearch.txt ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/src/docs/index-elasticsearch.txt b/extensions/indexing-elasticsearch/src/docs/index-elasticsearch.txt index 76581c6..51fdb99 100644 --- a/extensions/indexing-elasticsearch/src/docs/index-elasticsearch.txt +++ b/extensions/indexing-elasticsearch/src/docs/index-elasticsearch.txt @@ -32,10 +32,9 @@ 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: +Two modes of operation are supported: -- in-memory ; -- on-filesystem ; +- local filesystem ; - clustered. In any case, Lucene hard limits apply. @@ -45,25 +44,7 @@ Moreover, each field cannot be larger than 32766 bytes in its serialized form. include::../../build/docs/buildinfo/artifact.txt[] -== Embedded: in Memory or on FileSystem == - -Both in-memory and on-filesystem assemblies share the same configuration properties, see below. - -=== In Memory Assembly === - -In-memory ElasticSearch Index/Query service relies on the <<library-fileconfig>> 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: - -[snippet,java] ----- -source=extensions/indexing-elasticsearch/src/test/java/org/apache/zest/index/elasticsearch/DocumentationSupport.java -tag=memory ----- - - -=== On FileSystem Assembly === +== 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... @@ -81,7 +62,7 @@ tag=filesystem 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 both the in-memory and on-filesystem ElasticSearch Index/Query services: +Here are the configuration properties for the filesystem ElasticSearch Index/Query services: [snippet,java] ---- @@ -108,7 +89,7 @@ tag=cluster === Configuration === 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. +properties defined in the filesystem configuration, see above. [snippet,java] ---- http://git-wip-us.apache.org/repos/asf/zest-java/blob/04b74f21/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/assembly/ESMemoryIndexQueryAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/assembly/ESMemoryIndexQueryAssembler.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/assembly/ESMemoryIndexQueryAssembler.java deleted file mode 100644 index 4321d9d..0000000 --- a/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/assembly/ESMemoryIndexQueryAssembler.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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. - * - * - */ -package org.apache.zest.index.elasticsearch.assembly; - -import org.apache.zest.api.value.ValueSerialization; -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.index.elasticsearch.ElasticSearchConfiguration; -import org.apache.zest.index.elasticsearch.internal.AbstractElasticSearchAssembler; -import org.apache.zest.index.elasticsearch.memory.ESMemoryIndexQueryService; -import org.apache.zest.valueserialization.orgjson.OrgJsonValueSerializationService; - -public class ESMemoryIndexQueryAssembler - extends AbstractElasticSearchAssembler<ESMemoryIndexQueryAssembler> -{ - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.services( ESMemoryIndexQueryService.class ). - identifiedBy( identity() ). - visibleIn( visibility() ). - instantiateOnStartup(); - - module.services( OrgJsonValueSerializationService.class ). - taggedWith( ValueSerialization.Formats.JSON ); - - if( hasConfig() ) - { - configModule().entities( ElasticSearchConfiguration.class ). - visibleIn( configVisibility() ); - } - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/04b74f21/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/memory/ESMemoryIndexQueryService.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/memory/ESMemoryIndexQueryService.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/memory/ESMemoryIndexQueryService.java deleted file mode 100644 index 8fb420f..0000000 --- a/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/memory/ESMemoryIndexQueryService.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - * - * - */ -package org.apache.zest.index.elasticsearch.memory; - -import org.apache.zest.api.mixin.Mixins; -import org.apache.zest.api.service.ServiceComposite; -import org.apache.zest.index.elasticsearch.ElasticSearchFinder; -import org.apache.zest.index.elasticsearch.ElasticSearchIndexer; -import org.apache.zest.index.elasticsearch.ElasticSearchSupport; - -@Mixins( ESMemorySupport.class ) -public interface ESMemoryIndexQueryService - extends ElasticSearchIndexer, ElasticSearchFinder, ElasticSearchSupport, ServiceComposite -{ -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/04b74f21/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/memory/ESMemorySupport.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/memory/ESMemorySupport.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/memory/ESMemorySupport.java deleted file mode 100644 index 2239810..0000000 --- a/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/memory/ESMemorySupport.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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. - * - * - */ -package org.apache.zest.index.elasticsearch.memory; - -import java.io.File; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.node.Node; -import org.elasticsearch.node.NodeBuilder; -import org.apache.zest.api.configuration.Configuration; -import org.apache.zest.api.entity.Identity; -import org.apache.zest.api.injection.scope.Service; -import org.apache.zest.api.injection.scope.This; -import org.apache.zest.index.elasticsearch.ElasticSearchConfiguration; -import org.apache.zest.index.elasticsearch.internal.AbstractElasticSearchSupport; -import org.apache.zest.library.fileconfig.FileConfiguration; - -public class ESMemorySupport - extends AbstractElasticSearchSupport -{ - - @This - private Configuration<ElasticSearchConfiguration> configuration; - - @This - private Identity hasIdentity; - - @Service - private FileConfiguration fileConfig; - - private Node node; - - @Override - protected void activateElasticSearch() - throws Exception - { - configuration.refresh(); - ElasticSearchConfiguration config = configuration.get(); - - String clusterName = config.clusterName().get() == null ? DEFAULT_CLUSTER_NAME : config.clusterName().get(); - index = config.index().get() == null ? DEFAULT_INDEX_NAME : config.index().get(); - indexNonAggregatedAssociations = config.indexNonAggregatedAssociations().get(); - - String identity = hasIdentity.identity().get(); - Settings settings = Settings.settingsBuilder(). - put( "path.work", new File( new File( fileConfig.temporaryDirectory(), identity ), "work" ).getAbsolutePath() ). - put( "path.home", new File( new File( fileConfig.temporaryDirectory(), identity ), "home" ).getAbsolutePath() ). - put( "path.logs", new File( fileConfig.logDirectory(), identity ).getAbsolutePath() ). - put( "path.data", new File( fileConfig.dataDirectory(), identity ).getAbsolutePath() ). - put( "path.conf", new File( fileConfig.configurationDirectory(), identity ).getAbsolutePath() ). - put( "http.enabled", false ). - put( "index.cache.type", "weak" ). - put( "index.store.type", "memory" ). - put( "index.number_of_shards", 1 ). - put( "index.number_of_replicas", 0 ). - put( "index.refresh_interval", -1 ). // Controlled by ElasticSearchIndexer - build(); - node = NodeBuilder.nodeBuilder(). - clusterName( clusterName ). - settings( settings ). - local( true ). - node(); - client = node.client(); - } - - @Override - public void passivateElasticSearch() - throws Exception - { - node.close(); - node = null; - } - -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/04b74f21/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/memory/package.html ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/memory/package.html b/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/memory/package.html deleted file mode 100644 index 4d9f72e..0000000 --- a/extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/memory/package.html +++ /dev/null @@ -1,24 +0,0 @@ -<!-- - ~ 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. - ~ - ~ - --> -<html> - <body> - <h2>ElasticSearch Index/Query In-Memory Support.</h2> - </body> -</html> http://git-wip-us.apache.org/repos/asf/zest-java/blob/04b74f21/extensions/indexing-elasticsearch/src/test/java/org/apache/zest/index/elasticsearch/DocumentationSupport.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/src/test/java/org/apache/zest/index/elasticsearch/DocumentationSupport.java b/extensions/indexing-elasticsearch/src/test/java/org/apache/zest/index/elasticsearch/DocumentationSupport.java index 35bf72c..b25b648 100644 --- a/extensions/indexing-elasticsearch/src/test/java/org/apache/zest/index/elasticsearch/DocumentationSupport.java +++ b/extensions/indexing-elasticsearch/src/test/java/org/apache/zest/index/elasticsearch/DocumentationSupport.java @@ -25,7 +25,6 @@ import org.apache.zest.bootstrap.AssemblyException; import org.apache.zest.bootstrap.ModuleAssembly; import org.apache.zest.index.elasticsearch.assembly.ESClusterIndexQueryAssembler; import org.apache.zest.index.elasticsearch.assembly.ESFilesystemIndexQueryAssembler; -import org.apache.zest.index.elasticsearch.assembly.ESMemoryIndexQueryAssembler; public class DocumentationSupport implements Assembler @@ -38,10 +37,6 @@ public class DocumentationSupport ModuleAssembly configModule = module; Visibility configVisibility = Visibility.module; - // START SNIPPET: memory - new ESMemoryIndexQueryAssembler().withConfig( configModule, configVisibility ).assemble( module ); - // END SNIPPET: memory - // START SNIPPET: filesystem new ESFilesystemIndexQueryAssembler().withConfig( configModule, configVisibility ).assemble( module ); // END SNIPPET: filesystem
