james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [05/11] james-project git commit: JAMES-2590 Move ElasticSearch configuration classes to ES-backend
Date Fri, 07 Dec 2018 16:13:13 GMT
JAMES-2590 Move ElasticSearch configuration classes to ES-backend


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/a3f6c0b9
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/a3f6c0b9
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/a3f6c0b9

Branch: refs/heads/3.2.x
Commit: a3f6c0b907cf341dda01af472ea3000c89455242
Parents: bf833c8
Author: Antoine Duprat <aduprat@linagora.com>
Authored: Mon Nov 12 20:52:32 2018 +0100
Committer: Antoine Duprat <aduprat@linagora.com>
Committed: Fri Dec 7 17:11:56 2018 +0100

----------------------------------------------------------------------
 backends-common/elasticsearch/pom.xml           |   9 +
 .../backends/es/ElasticSearchConfiguration.java | 417 +++++++++++++++
 .../james/backends/es/IndexAttachments.java     |  24 +
 .../es/MailboxElasticSearchConstants.java       |  37 ++
 .../es/QuotaRatioElasticSearchConstants.java    |  37 ++
 .../es/ElasticSearchConfigurationTest.java      | 512 ++++++++++++++++++
 .../mailbox/elasticsearch/IndexAttachments.java |  24 -
 .../MailboxElasticSearchConstants.java          |  37 --
 .../elasticsearch/MailboxIndexCreationUtil.java |   1 +
 .../elasticsearch/MailboxMappingFactory.java    |   1 +
 ...lasticSearchListeningMessageSearchIndex.java |   2 +-
 .../elasticsearch/json/IndexableMessage.java    |   2 +-
 .../json/MessageToElasticSearchJson.java        |   2 +-
 .../ElasticSearchIntegrationTest.java           |   2 +
 .../json/IndexableMessageTest.java              |   2 +-
 .../json/MessageToElasticSearchJsonTest.java    |   2 +-
 .../ElasticSearchQuotaSearcher.java             |   2 +-
 .../QuotaRatioElasticSearchConstants.java       |  37 --
 .../elasticsearch/QuotaRatioMappingFactory.java |   1 +
 .../QuotaSearchIndexCreationUtil.java           |   1 +
 .../ElasticSearchQuotaMailboxListener.java      |   2 +-
 ...ticSearchQuotaSearchTestSystemExtension.java |   1 +
 .../ElasticSearchQuotaMailboxListenerTest.java  |   2 +-
 .../host/ElasticSearchHostSystem.java           |   4 +-
 .../mailbox/ElasticSearchConfiguration.java     | 423 ---------------
 .../mailbox/ElasticSearchMailboxModule.java     |   5 +-
 .../ElasticSearchQuotaSearcherModule.java       |   3 +-
 .../JamesServerWithRetryConnectionTest.java     |   4 +-
 .../mailbox/ElasticSearchConfigurationTest.java | 518 -------------------
 .../ElasticSearchQuotaSearchExtension.java      |   2 +-
 30 files changed, 1061 insertions(+), 1055 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/a3f6c0b9/backends-common/elasticsearch/pom.xml
----------------------------------------------------------------------
diff --git a/backends-common/elasticsearch/pom.xml b/backends-common/elasticsearch/pom.xml
index 02609a0..78b2af7 100644
--- a/backends-common/elasticsearch/pom.xml
+++ b/backends-common/elasticsearch/pom.xml
@@ -47,6 +47,10 @@
             <artifactId>throwing-lambdas</artifactId>
         </dependency>
         <dependency>
+            <groupId>commons-configuration</groupId>
+            <artifactId>commons-configuration</artifactId>
+        </dependency>
+        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <scope>test</scope>
@@ -74,6 +78,11 @@
         </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>
+            <artifactId>jcl-over-slf4j</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3f6c0b9/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/ElasticSearchConfiguration.java
----------------------------------------------------------------------
diff --git a/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/ElasticSearchConfiguration.java b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/ElasticSearchConfiguration.java
new file mode 100644
index 0000000..abb9026
--- /dev/null
+++ b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/ElasticSearchConfiguration.java
@@ -0,0 +1,417 @@
+/*
+ * 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.james.backends.es;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+
+import org.apache.commons.configuration.AbstractConfiguration;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.james.util.Host;
+import org.apache.james.util.OptionalUtils;
+
+import com.github.steveash.guavate.Guavate;
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableList;
+
+public class ElasticSearchConfiguration {
+
+    public static class Builder {
+
+        private final ImmutableList.Builder<Host> hosts;
+        private Optional<IndexName> indexMailboxName;
+        private Optional<ReadAliasName> readAliasMailboxName;
+        private Optional<WriteAliasName> writeAliasMailboxName;
+        private Optional<IndexName> indexQuotaRatioName;
+        private Optional<ReadAliasName> readAliasQuotaRatioName;
+        private Optional<WriteAliasName> writeAliasQuotaRatioName;
+        private Optional<Integer> nbShards;
+        private Optional<Integer> nbReplica;
+        private Optional<Integer> minDelay;
+        private Optional<Integer> maxRetries;
+        private Optional<IndexAttachments> indexAttachment;
+
+        public Builder() {
+            hosts = ImmutableList.builder();
+            indexMailboxName = Optional.empty();
+            readAliasMailboxName = Optional.empty();
+            writeAliasMailboxName = Optional.empty();
+            indexQuotaRatioName = Optional.empty();
+            readAliasQuotaRatioName = Optional.empty();
+            writeAliasQuotaRatioName = Optional.empty();
+            nbShards = Optional.empty();
+            nbReplica = Optional.empty();
+            minDelay = Optional.empty();
+            maxRetries = Optional.empty();
+            indexAttachment = Optional.empty();
+        }
+
+        public Builder addHost(Host host) {
+            this.hosts.add(host);
+            return this;
+        }
+
+        public Builder addHosts(Collection<Host> hosts) {
+            this.hosts.addAll(hosts);
+            return this;
+        }
+
+        public Builder indexMailboxName(IndexName indexMailboxName) {
+            return indexMailboxName(Optional.of(indexMailboxName));
+        }
+
+        public Builder indexMailboxName(Optional<IndexName> indexMailboxName) {
+            this.indexMailboxName = indexMailboxName;
+            return this;
+        }
+
+        public Builder readAliasMailboxName(ReadAliasName readAliasMailboxName) {
+            return readAliasMailboxName(Optional.of(readAliasMailboxName));
+        }
+
+        public Builder readAliasMailboxName(Optional<ReadAliasName> readAliasMailboxName) {
+            this.readAliasMailboxName = readAliasMailboxName;
+            return this;
+        }
+
+        public Builder writeAliasMailboxName(WriteAliasName writeAliasMailboxName) {
+            return writeAliasMailboxName(Optional.of(writeAliasMailboxName));
+        }
+
+        public Builder writeAliasMailboxName(Optional<WriteAliasName> writeAliasMailboxName) {
+            this.writeAliasMailboxName = writeAliasMailboxName;
+            return this;
+        }
+
+        public Builder indexQuotaRatioName(IndexName indexQuotaRatioName) {
+            return indexQuotaRatioName(Optional.of(indexQuotaRatioName));
+        }
+
+        public Builder indexQuotaRatioName(Optional<IndexName> indexQuotaRatioName) {
+            this.indexQuotaRatioName = indexQuotaRatioName;
+            return this;
+        }
+
+        public Builder readAliasQuotaRatioName(ReadAliasName readAliasQuotaRatioName) {
+            return readAliasQuotaRatioName(Optional.of(readAliasQuotaRatioName));
+        }
+
+        public Builder readAliasQuotaRatioName(Optional<ReadAliasName> readAliasQuotaRatioName) {
+            this.readAliasQuotaRatioName = readAliasQuotaRatioName;
+            return this;
+        }
+
+        public Builder writeAliasQuotaRatioName(WriteAliasName writeAliasQuotaRatioName) {
+            return writeAliasQuotaRatioName(Optional.of(writeAliasQuotaRatioName));
+        }
+
+        public Builder writeAliasQuotaRatioName(Optional<WriteAliasName> writeAliasQuotaRatioName) {
+            this.writeAliasQuotaRatioName = writeAliasQuotaRatioName;
+            return this;
+        }
+
+        public Builder indexAttachment(IndexAttachments indexAttachment) {
+            this.indexAttachment = Optional.of(indexAttachment);
+            return this;
+        }
+
+        public Builder nbShards(Optional<Integer> nbShards) {
+            this.nbShards = nbShards;
+            return this;
+        }
+
+        public Builder nbReplica(Optional<Integer> nbReplica) {
+            this.nbReplica = nbReplica;
+            return this;
+        }
+
+        public Builder minDelay(Optional<Integer> minDelay) {
+            this.minDelay = minDelay;
+            return this;
+        }
+
+        public Builder maxRetries(Optional<Integer> maxRetries) {
+            this.maxRetries = maxRetries;
+            return this;
+        }
+
+        public ElasticSearchConfiguration build() {
+            ImmutableList<Host> hosts = this.hosts.build();
+            Preconditions.checkState(!hosts.isEmpty(), "You need to specify ElasticSearch host");
+            return new ElasticSearchConfiguration(
+                hosts,
+                indexMailboxName.orElse(MailboxElasticSearchConstants.DEFAULT_MAILBOX_INDEX),
+                readAliasMailboxName.orElse(MailboxElasticSearchConstants.DEFAULT_MAILBOX_READ_ALIAS),
+                writeAliasMailboxName.orElse(MailboxElasticSearchConstants.DEFAULT_MAILBOX_WRITE_ALIAS),
+                indexQuotaRatioName.orElse(QuotaRatioElasticSearchConstants.DEFAULT_QUOTA_RATIO_INDEX),
+                readAliasQuotaRatioName.orElse(QuotaRatioElasticSearchConstants.DEFAULT_QUOTA_RATIO_READ_ALIAS),
+                writeAliasQuotaRatioName.orElse(QuotaRatioElasticSearchConstants.DEFAULT_QUOTA_RATIO_WRITE_ALIAS),
+                nbShards.orElse(DEFAULT_NB_SHARDS),
+                nbReplica.orElse(DEFAULT_NB_REPLICA),
+                minDelay.orElse(DEFAULT_CONNECTION_MIN_DELAY),
+                maxRetries.orElse(DEFAULT_CONNECTION_MAX_RETRIES),
+                indexAttachment.orElse(IndexAttachments.YES));
+        }
+    }
+
+    public static Builder builder() {
+        return new Builder();
+    }
+
+    public static final String ELASTICSEARCH_HOSTS = "elasticsearch.hosts";
+    public static final String ELASTICSEARCH_MASTER_HOST = "elasticsearch.masterHost";
+    public static final String ELASTICSEARCH_PORT = "elasticsearch.port";
+    public static final String ELASTICSEARCH_INDEX_NAME = "elasticsearch.index.name";
+    public static final String ELASTICSEARCH_INDEX_MAILBOX_NAME = "elasticsearch.index.mailbox.name";
+    public static final String ELASTICSEARCH_NB_REPLICA = "elasticsearch.nb.replica";
+    public static final String ELASTICSEARCH_NB_SHARDS = "elasticsearch.nb.shards";
+    public static final String ELASTICSEARCH_ALIAS_READ_NAME = "elasticsearch.alias.read.name";
+    public static final String ELASTICSEARCH_ALIAS_WRITE_NAME = "elasticsearch.alias.write.name";
+    public static final String ELASTICSEARCH_ALIAS_READ_MAILBOX_NAME = "elasticsearch.alias.read.mailbox.name";
+    public static final String ELASTICSEARCH_ALIAS_WRITE_MAILBOX_NAME = "elasticsearch.alias.write.mailbox.name";
+    public static final String ELASTICSEARCH_INDEX_QUOTA_RATIO_NAME = "elasticsearch.index.quota.ratio.name";
+    public static final String ELASTICSEARCH_ALIAS_READ_QUOTA_RATIO_NAME = "elasticsearch.alias.read.quota.ratio.name";
+    public static final String ELASTICSEARCH_ALIAS_WRITE_QUOTA_RATIO_NAME = "elasticsearch.alias.write.quota.ratio.name";
+    public static final String ELASTICSEARCH_RETRY_CONNECTION_MIN_DELAY = "elasticsearch.retryConnection.minDelay";
+    public static final String ELASTICSEARCH_RETRY_CONNECTION_MAX_RETRIES = "elasticsearch.retryConnection.maxRetries";
+    public static final String ELASTICSEARCH_INDEX_ATTACHMENTS = "elasticsearch.indexAttachments";
+
+    public static final int DEFAULT_CONNECTION_MAX_RETRIES = 7;
+    public static final int DEFAULT_CONNECTION_MIN_DELAY = 3000;
+    public static final boolean DEFAULT_INDEX_ATTACHMENTS = true;
+    public static final int DEFAULT_NB_SHARDS = 1;
+    public static final int DEFAULT_NB_REPLICA = 0;
+    public static final int DEFAULT_PORT = 9300;
+    private static final String LOCALHOST = "127.0.0.1";
+    public static final Optional<Integer> DEFAULT_PORT_AS_OPTIONAL = Optional.of(DEFAULT_PORT);
+
+    public static final ElasticSearchConfiguration DEFAULT_CONFIGURATION = builder()
+        .addHost(Host.from(LOCALHOST, DEFAULT_PORT))
+        .build();
+
+    public static ElasticSearchConfiguration fromProperties(Configuration configuration) throws ConfigurationException {
+        return builder()
+            .addHosts(getHosts(configuration))
+            .indexMailboxName(computeMailboxIndexName(configuration))
+            .readAliasMailboxName(computeMailboxReadAlias(configuration))
+            .writeAliasMailboxName(computeMailboxWriteAlias(configuration))
+            .indexQuotaRatioName(computeQuotaSearchIndexName(configuration))
+            .readAliasQuotaRatioName(computeQuotaSearchReadAlias(configuration))
+            .writeAliasQuotaRatioName(computeQuotaSearchWriteAlias(configuration))
+            .nbShards(Optional.ofNullable(configuration.getInteger(ELASTICSEARCH_NB_SHARDS, null)))
+            .nbReplica(Optional.ofNullable(configuration.getInteger(ELASTICSEARCH_NB_REPLICA, null)))
+            .minDelay(Optional.ofNullable(configuration.getInteger(ELASTICSEARCH_RETRY_CONNECTION_MIN_DELAY, null)))
+            .maxRetries(Optional.ofNullable(configuration.getInteger(ELASTICSEARCH_RETRY_CONNECTION_MAX_RETRIES, null)))
+            .indexAttachment(provideIndexAttachments(configuration))
+            .build();
+    }
+
+    public static Optional<IndexName> computeMailboxIndexName(Configuration configuration) {
+        return OptionalUtils.or(
+            Optional.ofNullable(configuration.getString(ELASTICSEARCH_INDEX_MAILBOX_NAME))
+                .map(IndexName::new),
+            Optional.ofNullable(configuration.getString(ELASTICSEARCH_INDEX_NAME))
+                .map(IndexName::new));
+    }
+
+    public static Optional<WriteAliasName> computeMailboxWriteAlias(Configuration configuration) {
+        return OptionalUtils.or(
+            Optional.ofNullable(configuration.getString(ELASTICSEARCH_ALIAS_WRITE_MAILBOX_NAME))
+                .map(WriteAliasName::new),
+            Optional.ofNullable(configuration.getString(ELASTICSEARCH_ALIAS_WRITE_NAME))
+                .map(WriteAliasName::new));
+    }
+
+    public static Optional<ReadAliasName> computeMailboxReadAlias(Configuration configuration) {
+        return OptionalUtils.or(
+            Optional.ofNullable(configuration.getString(ELASTICSEARCH_ALIAS_READ_MAILBOX_NAME))
+                .map(ReadAliasName::new),
+            Optional.ofNullable(configuration.getString(ELASTICSEARCH_ALIAS_READ_NAME))
+                .map(ReadAliasName::new));
+    }
+
+    public static Optional<IndexName> computeQuotaSearchIndexName(Configuration configuration) {
+        return Optional.ofNullable(configuration.getString(ELASTICSEARCH_INDEX_QUOTA_RATIO_NAME))
+            .map(IndexName::new);
+    }
+
+    public static Optional<WriteAliasName> computeQuotaSearchWriteAlias(Configuration configuration) {
+        return Optional.ofNullable(configuration.getString(ELASTICSEARCH_ALIAS_WRITE_QUOTA_RATIO_NAME))
+            .map(WriteAliasName::new);
+    }
+
+    public static Optional<ReadAliasName> computeQuotaSearchReadAlias(Configuration configuration) {
+        return Optional.ofNullable(configuration.getString(ELASTICSEARCH_ALIAS_READ_QUOTA_RATIO_NAME))
+                .map(ReadAliasName::new);
+    }
+
+    private static IndexAttachments provideIndexAttachments(Configuration configuration) {
+        if (configuration.getBoolean(ELASTICSEARCH_INDEX_ATTACHMENTS, DEFAULT_INDEX_ATTACHMENTS)) {
+            return IndexAttachments.YES;
+        }
+        return IndexAttachments.NO;
+    }
+
+    private static ImmutableList<Host> getHosts(Configuration propertiesReader) throws ConfigurationException {
+        AbstractConfiguration.setDefaultListDelimiter(',');
+        Optional<String> masterHost = Optional.ofNullable(
+            propertiesReader.getString(ELASTICSEARCH_MASTER_HOST, null));
+        Optional<Integer> masterPort = Optional.ofNullable(
+            propertiesReader.getInteger(ELASTICSEARCH_PORT, null));
+        List<String> multiHosts = Arrays.asList(propertiesReader.getStringArray(ELASTICSEARCH_HOSTS));
+
+        validateHostsConfigurationOptions(masterHost, masterPort, multiHosts);
+
+        if (masterHost.isPresent()) {
+            return ImmutableList.of(
+                Host.from(masterHost.get(),
+                masterPort.get()));
+        } else {
+            return multiHosts.stream()
+                .map(ipAndPort -> Host.parse(ipAndPort, DEFAULT_PORT_AS_OPTIONAL))
+                .collect(Guavate.toImmutableList());
+        }
+    }
+
+    @VisibleForTesting
+    static void validateHostsConfigurationOptions(Optional<String> masterHost,
+                                                  Optional<Integer> masterPort,
+                                                  List<String> multiHosts) throws ConfigurationException {
+        if (masterHost.isPresent() != masterPort.isPresent()) {
+            throw new ConfigurationException(ELASTICSEARCH_MASTER_HOST + " and " + ELASTICSEARCH_PORT + " should be specified together");
+        }
+        if (!multiHosts.isEmpty() && masterHost.isPresent()) {
+            throw new ConfigurationException("You should choose between mono host set up and " + ELASTICSEARCH_HOSTS);
+        }
+        if (multiHosts.isEmpty() && !masterHost.isPresent()) {
+            throw new ConfigurationException("You should specify either (" + ELASTICSEARCH_MASTER_HOST + " and " + ELASTICSEARCH_PORT + ") or " + ELASTICSEARCH_HOSTS);
+        }
+    }
+
+    private final ImmutableList<Host> hosts;
+    private final IndexName indexMailboxName;
+    private final ReadAliasName readAliasMailboxName;
+    private final WriteAliasName writeAliasMailboxName;
+    private final IndexName indexQuotaRatioName;
+    private final ReadAliasName readAliasQuotaRatioName;
+    private final WriteAliasName writeAliasQuotaRatioName;
+    private final int nbShards;
+    private final int nbReplica;
+    private final int minDelay;
+    private final int maxRetries;
+    private final IndexAttachments indexAttachment;
+
+    private ElasticSearchConfiguration(ImmutableList<Host> hosts, IndexName indexMailboxName, ReadAliasName readAliasMailboxName,
+                                      WriteAliasName writeAliasMailboxName, IndexName indexQuotaRatioName, ReadAliasName readAliasQuotaRatioName, WriteAliasName writeAliasQuotaRatioName, int nbShards, int nbReplica, int minDelay,
+                                      int maxRetries, IndexAttachments indexAttachment) {
+        this.hosts = hosts;
+        this.indexMailboxName = indexMailboxName;
+        this.readAliasMailboxName = readAliasMailboxName;
+        this.writeAliasMailboxName = writeAliasMailboxName;
+        this.indexQuotaRatioName = indexQuotaRatioName;
+        this.readAliasQuotaRatioName = readAliasQuotaRatioName;
+        this.writeAliasQuotaRatioName = writeAliasQuotaRatioName;
+        this.nbShards = nbShards;
+        this.nbReplica = nbReplica;
+        this.minDelay = minDelay;
+        this.maxRetries = maxRetries;
+        this.indexAttachment = indexAttachment;
+    }
+
+    public ImmutableList<Host> getHosts() {
+        return hosts;
+    }
+
+    public IndexName getIndexMailboxName() {
+        return indexMailboxName;
+    }
+
+    public ReadAliasName getReadAliasMailboxName() {
+        return readAliasMailboxName;
+    }
+
+    public WriteAliasName getWriteAliasMailboxName() {
+        return writeAliasMailboxName;
+    }
+
+    public int getNbShards() {
+        return nbShards;
+    }
+
+    public int getNbReplica() {
+        return nbReplica;
+    }
+
+    public int getMinDelay() {
+        return minDelay;
+    }
+
+    public int getMaxRetries() {
+        return maxRetries;
+    }
+
+    public IndexAttachments getIndexAttachment() {
+        return indexAttachment;
+    }
+
+    public IndexName getIndexQuotaRatioName() {
+        return indexQuotaRatioName;
+    }
+
+    public ReadAliasName getReadAliasQuotaRatioName() {
+        return readAliasQuotaRatioName;
+    }
+
+    public WriteAliasName getWriteAliasQuotaRatioName() {
+        return writeAliasQuotaRatioName;
+    }
+
+    @Override
+    public final boolean equals(Object o) {
+        if (o instanceof ElasticSearchConfiguration) {
+            ElasticSearchConfiguration that = (ElasticSearchConfiguration) o;
+
+            return Objects.equals(this.nbShards, that.nbShards)
+                && Objects.equals(this.nbReplica, that.nbReplica)
+                && Objects.equals(this.minDelay, that.minDelay)
+                && Objects.equals(this.maxRetries, that.maxRetries)
+                && Objects.equals(this.indexAttachment, that.indexAttachment)
+                && Objects.equals(this.hosts, that.hosts)
+                && Objects.equals(this.indexMailboxName, that.indexMailboxName)
+                && Objects.equals(this.readAliasMailboxName, that.readAliasMailboxName)
+                && Objects.equals(this.writeAliasMailboxName, that.writeAliasMailboxName)
+                && Objects.equals(this.indexQuotaRatioName, that.indexQuotaRatioName)
+                && Objects.equals(this.readAliasQuotaRatioName, that.readAliasQuotaRatioName)
+                && Objects.equals(this.writeAliasQuotaRatioName, that.writeAliasQuotaRatioName);
+        }
+        return false;
+    }
+
+    @Override
+    public final int hashCode() {
+        return Objects.hash(hosts, indexMailboxName, readAliasMailboxName, writeAliasMailboxName, nbShards,
+            nbReplica, minDelay, maxRetries, indexAttachment, indexQuotaRatioName, readAliasQuotaRatioName, writeAliasMailboxName);
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3f6c0b9/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/IndexAttachments.java
----------------------------------------------------------------------
diff --git a/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/IndexAttachments.java b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/IndexAttachments.java
new file mode 100644
index 0000000..dabbfb3
--- /dev/null
+++ b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/IndexAttachments.java
@@ -0,0 +1,24 @@
+/*
+ * 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.james.backends.es;
+
+public enum IndexAttachments {
+    NO, YES
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3f6c0b9/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/MailboxElasticSearchConstants.java
----------------------------------------------------------------------
diff --git a/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/MailboxElasticSearchConstants.java b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/MailboxElasticSearchConstants.java
new file mode 100644
index 0000000..d3c1022
--- /dev/null
+++ b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/MailboxElasticSearchConstants.java
@@ -0,0 +1,37 @@
+/*
+ * 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.james.backends.es;
+
+import org.apache.james.backends.es.IndexName;
+import org.apache.james.backends.es.ReadAliasName;
+import org.apache.james.backends.es.TypeName;
+import org.apache.james.backends.es.WriteAliasName;
+
+public interface MailboxElasticSearchConstants {
+
+    interface InjectionNames {
+        String MAILBOX = "mailbox";
+    }
+
+    WriteAliasName DEFAULT_MAILBOX_WRITE_ALIAS = new WriteAliasName("mailboxWriteAlias");
+    ReadAliasName DEFAULT_MAILBOX_READ_ALIAS = new ReadAliasName("mailboxReadAlias");
+    IndexName DEFAULT_MAILBOX_INDEX = new IndexName("mailbox_v1");
+    TypeName MESSAGE_TYPE = new TypeName("message");
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3f6c0b9/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/QuotaRatioElasticSearchConstants.java
----------------------------------------------------------------------
diff --git a/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/QuotaRatioElasticSearchConstants.java b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/QuotaRatioElasticSearchConstants.java
new file mode 100644
index 0000000..3bc650d
--- /dev/null
+++ b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/QuotaRatioElasticSearchConstants.java
@@ -0,0 +1,37 @@
+/*
+ * 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.james.backends.es;
+
+import org.apache.james.backends.es.IndexName;
+import org.apache.james.backends.es.ReadAliasName;
+import org.apache.james.backends.es.TypeName;
+import org.apache.james.backends.es.WriteAliasName;
+
+public interface QuotaRatioElasticSearchConstants {
+
+    interface InjectionNames {
+        String QUOTA_RATIO = "quotaRatio";
+    }
+
+    WriteAliasName DEFAULT_QUOTA_RATIO_WRITE_ALIAS = new WriteAliasName("quotaRatioWriteAlias");
+    ReadAliasName DEFAULT_QUOTA_RATIO_READ_ALIAS = new ReadAliasName("quotaRatioReadAlias");
+    IndexName DEFAULT_QUOTA_RATIO_INDEX = new IndexName("quota_ratio_v1");
+    TypeName QUOTA_RATIO_TYPE = new TypeName("quotaRatio");
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3f6c0b9/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ElasticSearchConfigurationTest.java
----------------------------------------------------------------------
diff --git a/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ElasticSearchConfigurationTest.java b/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ElasticSearchConfigurationTest.java
new file mode 100644
index 0000000..6fa85ac
--- /dev/null
+++ b/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ElasticSearchConfigurationTest.java
@@ -0,0 +1,512 @@
+/*
+ * 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.james.backends.es;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+import java.util.Optional;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.james.util.Host;
+import org.junit.Test;
+
+import com.google.common.collect.ImmutableList;
+
+public class ElasticSearchConfigurationTest {
+
+    @Test
+    public void getNbReplicaShouldReturnConfiguredValue() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        int value = 36;
+        configuration.addProperty("elasticsearch.nb.replica", value);
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getNbReplica())
+            .isEqualTo(value);
+    }
+
+    @Test
+    public void getNbReplicaShouldReturnDefaultValueWhenMissing() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getNbReplica())
+            .isEqualTo(ElasticSearchConfiguration.DEFAULT_NB_REPLICA);
+    }
+
+    @Test
+    public void getNbShardsShouldReturnConfiguredValue() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        int value = 36;
+        configuration.addProperty("elasticsearch.nb.shards", value);
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getNbShards())
+            .isEqualTo(value);
+    }
+
+    @Test
+    public void getNbShardsShouldReturnDefaultValueWhenMissing() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getNbShards())
+            .isEqualTo(ElasticSearchConfiguration.DEFAULT_NB_SHARDS);
+    }
+
+    @Test
+    public void getMaxRetriesShouldReturnConfiguredValue() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        int value = 36;
+        configuration.addProperty("elasticsearch.retryConnection.maxRetries", value);
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getMaxRetries())
+            .isEqualTo(value);
+    }
+
+    @Test
+    public void getMaxRetriesShouldReturnDefaultValueWhenMissing() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getMaxRetries())
+            .isEqualTo(ElasticSearchConfiguration.DEFAULT_CONNECTION_MAX_RETRIES);
+    }
+
+    @Test
+    public void getMinDelayShouldReturnConfiguredValue() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        int value = 36;
+        configuration.addProperty("elasticsearch.retryConnection.minDelay", value);
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getMinDelay())
+            .isEqualTo(value);
+    }
+
+    @Test
+    public void getMinDelayShouldReturnDefaultValueWhenMissing() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getMinDelay())
+            .isEqualTo(ElasticSearchConfiguration.DEFAULT_CONNECTION_MIN_DELAY);
+    }
+
+    @Test
+    public void getIndexMailboxNameShouldReturnOldConfiguredValue() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        String name = "name";
+        configuration.addProperty("elasticsearch.index.name", name);
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getIndexMailboxName())
+            .isEqualTo(new IndexName(name));
+    }
+
+    @Test
+    public void getIndexMailboxNameShouldReturnNewConfiguredValueWhenBoth() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        String name = "name";
+        configuration.addProperty("elasticsearch.index.name", "other");
+        configuration.addProperty("elasticsearch.index.mailbox.name", name);
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getIndexMailboxName())
+            .isEqualTo(new IndexName(name));
+    }
+
+    @Test
+    public void getIndexMailboxNameShouldReturnConfiguredValue() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        String name = "name";
+        configuration.addProperty("elasticsearch.index.mailbox.name", name);
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getIndexMailboxName())
+            .isEqualTo(new IndexName(name));
+    }
+
+    @Test
+    public void getIndexMailboxNameShouldReturnDefaultValueWhenMissing() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getIndexMailboxName())
+            .isEqualTo(MailboxElasticSearchConstants.DEFAULT_MAILBOX_INDEX);
+    }
+
+    @Test
+    public void getReadAliasMailboxNameShouldReturnOldConfiguredValue() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        String name = "name";
+        configuration.addProperty("elasticsearch.alias.read.name", name);
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getReadAliasMailboxName())
+            .isEqualTo(new ReadAliasName(name));
+    }
+
+    @Test
+    public void getReadAliasMailboxNameShouldReturnConfiguredValue() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        String name = "name";
+        configuration.addProperty("elasticsearch.alias.read.mailbox.name", name);
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getReadAliasMailboxName())
+            .isEqualTo(new ReadAliasName(name));
+    }
+
+    @Test
+    public void getReadAliasMailboxNameShouldReturnNewConfiguredValueWhenBoth() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        String name = "name";
+        configuration.addProperty("elasticsearch.alias.read.mailbox.name", name);
+        configuration.addProperty("elasticsearch.alias.read.name", "other");
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getReadAliasMailboxName())
+            .isEqualTo(new ReadAliasName(name));
+    }
+
+    @Test
+    public void getReadAliasMailboxNameShouldReturnDefaultValueWhenMissing() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getReadAliasMailboxName())
+            .isEqualTo(MailboxElasticSearchConstants.DEFAULT_MAILBOX_READ_ALIAS);
+    }
+
+    @Test
+    public void getWriteAliasMailboxNameShouldReturnOldConfiguredValue() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        String name = "name";
+        configuration.addProperty("elasticsearch.alias.write.name", name);
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getWriteAliasMailboxName())
+            .isEqualTo(new WriteAliasName(name));
+    }
+
+    @Test
+    public void getWriteAliasMailboxNameShouldReturnConfiguredValue() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        String name = "name";
+        configuration.addProperty("elasticsearch.alias.write.mailbox.name", name);
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getWriteAliasMailboxName())
+            .isEqualTo(new WriteAliasName(name));
+    }
+
+    @Test
+    public void getWriteAliasMailboxNameShouldReturnNewConfiguredValueWhenBoth() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        String name = "name";
+        configuration.addProperty("elasticsearch.alias.write.mailbox.name", name);
+        configuration.addProperty("elasticsearch.alias.write.name", "other");
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getWriteAliasMailboxName())
+            .isEqualTo(new WriteAliasName(name));
+    }
+
+    @Test
+    public void getWriteAliasMailboxNameShouldReturnDefaultValueWhenMissing() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getWriteAliasMailboxName())
+            .isEqualTo(MailboxElasticSearchConstants.DEFAULT_MAILBOX_WRITE_ALIAS);
+    }
+
+    @Test
+    public void getReadAliasQuotaRatioNameShouldReturnConfiguredValue() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        String name = "name";
+        configuration.addProperty("elasticsearch.alias.read.quota.ratio.name", name);
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getReadAliasQuotaRatioName())
+            .isEqualTo(new ReadAliasName(name));
+    }
+
+    @Test
+    public void getReadAliasQuotaRatioNameShouldReturnDefaultValueWhenMissing() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getReadAliasQuotaRatioName())
+            .isEqualTo(QuotaRatioElasticSearchConstants.DEFAULT_QUOTA_RATIO_READ_ALIAS);
+    }
+
+    @Test
+    public void getWriteAliasQuotaRatioNameShouldReturnConfiguredValue() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        String name = "name";
+        configuration.addProperty("elasticsearch.alias.write.quota.ratio.name", name);
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getWriteAliasQuotaRatioName())
+            .isEqualTo(new WriteAliasName(name));
+    }
+
+    @Test
+    public void getWriteAliasQuotaRatioNameShouldReturnDefaultValueWhenMissing() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getWriteAliasQuotaRatioName())
+            .isEqualTo(QuotaRatioElasticSearchConstants.DEFAULT_QUOTA_RATIO_WRITE_ALIAS);
+    }
+
+    @Test
+    public void getIndexQuotaRatioNameShouldReturnConfiguredValue() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        String name = "name";
+        configuration.addProperty("elasticsearch.index.quota.ratio.name", name);
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getIndexQuotaRatioName())
+            .isEqualTo(new IndexName(name));
+    }
+
+    @Test
+    public void getIndexQuotaRatioNameShouldReturnDefaultValueWhenMissing() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getIndexQuotaRatioName())
+            .isEqualTo(QuotaRatioElasticSearchConstants.DEFAULT_QUOTA_RATIO_INDEX);
+    }
+
+    @Test
+    public void getIndexAttachmentShouldReturnConfiguredValueWhenTrue() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        configuration.addProperty("elasticsearch.indexAttachments", true);
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getIndexAttachment())
+            .isEqualTo(IndexAttachments.YES);
+    }
+
+    @Test
+    public void getIndexAttachmentShouldReturnConfiguredValueWhenFalse() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        configuration.addProperty("elasticsearch.indexAttachments", false);
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getIndexAttachment())
+            .isEqualTo(IndexAttachments.NO);
+    }
+
+    @Test
+    public void getIndexAttachmentShouldReturnDefaultValueWhenMissing() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        configuration.addProperty("elasticsearch.hosts", "127.0.0.1");
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getIndexAttachment())
+            .isEqualTo(IndexAttachments.YES);
+    }
+
+
+    @Test
+    public void getHostsShouldReturnConfiguredHostsWhenNoPort() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        String hostname = "myHost";
+        configuration.addProperty("elasticsearch.hosts", hostname);
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getHosts())
+            .containsOnly(Host.from(hostname, ElasticSearchConfiguration.DEFAULT_PORT));
+    }
+
+    @Test
+    public void getHostsShouldReturnConfiguredHostsWhenListIsUsed() throws ConfigurationException {
+        String hostname = "myHost";
+        String hostname2 = "myOtherHost";
+        int port = 2154;
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        configuration.addProperty("elasticsearch.hosts", hostname + "," + hostname2 + ":" + port);
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getHosts())
+            .containsOnly(Host.from(hostname, ElasticSearchConfiguration.DEFAULT_PORT),
+                Host.from(hostname2, port));
+    }
+
+    @Test
+    public void getHostsShouldReturnConfiguredHosts() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        String hostname = "myHost";
+        int port = 2154;
+        configuration.addProperty("elasticsearch.hosts", hostname + ":" + port);
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getHosts())
+            .containsOnly(Host.from(hostname, port));
+    }
+
+    @Test
+    public void getHostsShouldReturnConfiguredMasterHost() throws ConfigurationException {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        String hostname = "myHost";
+        configuration.addProperty("elasticsearch.masterHost", hostname);
+        int port = 9300;
+        configuration.addProperty("elasticsearch.port", port);
+
+        ElasticSearchConfiguration elasticSearchConfiguration = ElasticSearchConfiguration.fromProperties(configuration);
+
+        assertThat(elasticSearchConfiguration.getHosts())
+            .containsOnly(Host.from(hostname, port));
+    }
+
+    @Test
+    public void validateHostsConfigurationOptionsShouldThrowWhenNoHostSpecify() {
+        assertThatThrownBy(() ->
+            ElasticSearchConfiguration.validateHostsConfigurationOptions(
+                Optional.empty(),
+                Optional.empty(),
+                ImmutableList.of()))
+            .isInstanceOf(ConfigurationException.class)
+            .hasMessage("You should specify either (" + ElasticSearchConfiguration.ELASTICSEARCH_MASTER_HOST +
+                " and " + ElasticSearchConfiguration.ELASTICSEARCH_PORT +
+                ") or " + ElasticSearchConfiguration.ELASTICSEARCH_HOSTS);
+    }
+
+    @Test
+    public void validateHostsConfigurationOptionsShouldThrowWhenMonoAndMultiHostSpecified() {
+        assertThatThrownBy(() ->
+            ElasticSearchConfiguration.validateHostsConfigurationOptions(
+                Optional.of("localhost"),
+                Optional.of(9200),
+                ImmutableList.of("localhost:9200")))
+            .isInstanceOf(ConfigurationException.class)
+            .hasMessage("You should choose between mono host set up and " + ElasticSearchConfiguration.ELASTICSEARCH_HOSTS);
+    }
+
+    @Test
+    public void validateHostsConfigurationOptionsShouldThrowWhenMonoHostWithoutPort() {
+        assertThatThrownBy(() ->
+            ElasticSearchConfiguration.validateHostsConfigurationOptions(
+                Optional.of("localhost"),
+                Optional.empty(),
+                ImmutableList.of()))
+            .isInstanceOf(ConfigurationException.class)
+            .hasMessage(ElasticSearchConfiguration.ELASTICSEARCH_MASTER_HOST +
+                " and " + ElasticSearchConfiguration.ELASTICSEARCH_PORT + " should be specified together");
+    }
+
+    @Test
+    public void validateHostsConfigurationOptionsShouldThrowWhenMonoHostWithoutAddress() {
+        assertThatThrownBy(() ->
+        ElasticSearchConfiguration.validateHostsConfigurationOptions(
+            Optional.empty(),
+            Optional.of(9200),
+            ImmutableList.of()))
+        .isInstanceOf(ConfigurationException.class)
+        .hasMessage(ElasticSearchConfiguration.ELASTICSEARCH_MASTER_HOST + " and " +
+            ElasticSearchConfiguration.ELASTICSEARCH_PORT + " should be specified together");
+    }
+
+    @Test
+    public void validateHostsConfigurationOptionsShouldAcceptMonoHostConfiguration() throws Exception {
+        ElasticSearchConfiguration.validateHostsConfigurationOptions(
+            Optional.of("localhost"),
+            Optional.of(9200),
+            ImmutableList.of());
+    }
+
+    @Test
+    public void validateHostsConfigurationOptionsShouldAcceptMultiHostConfiguration() throws Exception {
+        ElasticSearchConfiguration.validateHostsConfigurationOptions(
+            Optional.empty(),
+            Optional.empty(),
+            ImmutableList.of("localhost:9200"));
+    }
+
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3f6c0b9/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/IndexAttachments.java
----------------------------------------------------------------------
diff --git a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/IndexAttachments.java b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/IndexAttachments.java
deleted file mode 100644
index 9b94a0f..0000000
--- a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/IndexAttachments.java
+++ /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.                                           *
- ****************************************************************/
-
-package org.apache.james.mailbox.elasticsearch;
-
-public enum IndexAttachments {
-    NO, YES
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3f6c0b9/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/MailboxElasticSearchConstants.java
----------------------------------------------------------------------
diff --git a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/MailboxElasticSearchConstants.java b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/MailboxElasticSearchConstants.java
deleted file mode 100644
index 79797f4..0000000
--- a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/MailboxElasticSearchConstants.java
+++ /dev/null
@@ -1,37 +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.james.mailbox.elasticsearch;
-
-import org.apache.james.backends.es.IndexName;
-import org.apache.james.backends.es.ReadAliasName;
-import org.apache.james.backends.es.TypeName;
-import org.apache.james.backends.es.WriteAliasName;
-
-public interface MailboxElasticSearchConstants {
-
-    interface InjectionNames {
-        String MAILBOX = "mailbox";
-    }
-
-    WriteAliasName DEFAULT_MAILBOX_WRITE_ALIAS = new WriteAliasName("mailboxWriteAlias");
-    ReadAliasName DEFAULT_MAILBOX_READ_ALIAS = new ReadAliasName("mailboxReadAlias");
-    IndexName DEFAULT_MAILBOX_INDEX = new IndexName("mailbox_v1");
-    TypeName MESSAGE_TYPE = new TypeName("message");
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3f6c0b9/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/MailboxIndexCreationUtil.java
----------------------------------------------------------------------
diff --git a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/MailboxIndexCreationUtil.java b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/MailboxIndexCreationUtil.java
index 89c7227..506c05b 100644
--- a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/MailboxIndexCreationUtil.java
+++ b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/MailboxIndexCreationUtil.java
@@ -21,6 +21,7 @@ package org.apache.james.mailbox.elasticsearch;
 
 import org.apache.james.backends.es.IndexCreationFactory;
 import org.apache.james.backends.es.IndexName;
+import org.apache.james.backends.es.MailboxElasticSearchConstants;
 import org.apache.james.backends.es.NodeMappingFactory;
 import org.apache.james.backends.es.ReadAliasName;
 import org.apache.james.backends.es.WriteAliasName;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3f6c0b9/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/MailboxMappingFactory.java
----------------------------------------------------------------------
diff --git a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/MailboxMappingFactory.java b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/MailboxMappingFactory.java
index d6acd0b..3d461da 100644
--- a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/MailboxMappingFactory.java
+++ b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/MailboxMappingFactory.java
@@ -69,6 +69,7 @@ import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
 
 import java.io.IOException;
 
+import org.apache.james.backends.es.MailboxElasticSearchConstants;
 import org.apache.james.backends.es.NodeMappingFactory;
 import org.apache.james.mailbox.elasticsearch.json.JsonMessageConstants.EMailer;
 import org.apache.james.mailbox.elasticsearch.json.JsonMessageConstants.Property;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3f6c0b9/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/events/ElasticSearchListeningMessageSearchIndex.java
----------------------------------------------------------------------
diff --git a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/events/ElasticSearchListeningMessageSearchIndex.java b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/events/ElasticSearchListeningMessageSearchIndex.java
index ed008ef..495e33d 100644
--- a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/events/ElasticSearchListeningMessageSearchIndex.java
+++ b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/events/ElasticSearchListeningMessageSearchIndex.java
@@ -31,12 +31,12 @@ import javax.inject.Inject;
 import javax.inject.Named;
 
 import org.apache.james.backends.es.ElasticSearchIndexer;
+import org.apache.james.backends.es.MailboxElasticSearchConstants;
 import org.apache.james.backends.es.UpdatedRepresentation;
 import org.apache.james.mailbox.MailboxManager.MessageCapabilities;
 import org.apache.james.mailbox.MailboxManager.SearchCapabilities;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.MessageUid;
-import org.apache.james.mailbox.elasticsearch.MailboxElasticSearchConstants;
 import org.apache.james.mailbox.elasticsearch.json.JsonMessageConstants;
 import org.apache.james.mailbox.elasticsearch.json.MessageToElasticSearchJson;
 import org.apache.james.mailbox.elasticsearch.search.ElasticSearchSearcher;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3f6c0b9/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessage.java
----------------------------------------------------------------------
diff --git a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessage.java b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessage.java
index b6d9527..53df8d6 100644
--- a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessage.java
+++ b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessage.java
@@ -28,8 +28,8 @@ import java.util.Optional;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
+import org.apache.james.backends.es.IndexAttachments;
 import org.apache.james.mailbox.MailboxSession.User;
-import org.apache.james.mailbox.elasticsearch.IndexAttachments;
 import org.apache.james.mailbox.elasticsearch.query.DateResolutionFormater;
 import org.apache.james.mailbox.extractor.TextExtractor;
 import org.apache.james.mailbox.store.mail.model.MailboxMessage;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3f6c0b9/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJson.java
----------------------------------------------------------------------
diff --git a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJson.java b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJson.java
index aacd790..c40d5c9 100644
--- a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJson.java
+++ b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJson.java
@@ -25,9 +25,9 @@ import java.util.List;
 import javax.inject.Inject;
 import javax.mail.Flags;
 
+import org.apache.james.backends.es.IndexAttachments;
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxSession.User;
-import org.apache.james.mailbox.elasticsearch.IndexAttachments;
 import org.apache.james.mailbox.extractor.TextExtractor;
 import org.apache.james.mailbox.store.mail.model.MailboxMessage;
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3f6c0b9/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIntegrationTest.java
----------------------------------------------------------------------
diff --git a/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIntegrationTest.java b/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIntegrationTest.java
index c6225c9..bb22f74 100644
--- a/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIntegrationTest.java
+++ b/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIntegrationTest.java
@@ -27,6 +27,8 @@ import java.util.concurrent.Executors;
 
 import org.apache.james.backends.es.ElasticSearchIndexer;
 import org.apache.james.backends.es.EmbeddedElasticSearch;
+import org.apache.james.backends.es.IndexAttachments;
+import org.apache.james.backends.es.MailboxElasticSearchConstants;
 import org.apache.james.backends.es.utils.TestingClientProvider;
 import org.apache.james.mailbox.MessageManager;
 import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3f6c0b9/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessageTest.java
----------------------------------------------------------------------
diff --git a/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessageTest.java b/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessageTest.java
index 40b641e..9443c9c 100644
--- a/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessageTest.java
+++ b/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessageTest.java
@@ -32,7 +32,7 @@ import java.util.Optional;
 import javax.mail.Flags;
 
 import org.apache.james.mailbox.MessageUid;
-import org.apache.james.mailbox.elasticsearch.IndexAttachments;
+import org.apache.james.backends.es.IndexAttachments;
 import org.apache.james.mailbox.extractor.ParsedContent;
 import org.apache.james.mailbox.extractor.TextExtractor;
 import org.apache.james.mailbox.inmemory.InMemoryMessageId;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3f6c0b9/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJsonTest.java
----------------------------------------------------------------------
diff --git a/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJsonTest.java b/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJsonTest.java
index fa080f3..3b50399 100644
--- a/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJsonTest.java
+++ b/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJsonTest.java
@@ -35,7 +35,7 @@ import javax.mail.util.SharedByteArrayInputStream;
 import org.apache.james.mailbox.FlagsBuilder;
 import org.apache.james.mailbox.MailboxSession.User;
 import org.apache.james.mailbox.MessageUid;
-import org.apache.james.mailbox.elasticsearch.IndexAttachments;
+import org.apache.james.backends.es.IndexAttachments;
 import org.apache.james.mailbox.extractor.TextExtractor;
 import org.apache.james.mailbox.mock.MockMailboxSession;
 import org.apache.james.mailbox.model.MessageId;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3f6c0b9/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/ElasticSearchQuotaSearcher.java
----------------------------------------------------------------------
diff --git a/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/ElasticSearchQuotaSearcher.java b/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/ElasticSearchQuotaSearcher.java
index 21d55a8..59bb8f6 100644
--- a/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/ElasticSearchQuotaSearcher.java
+++ b/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/ElasticSearchQuotaSearcher.java
@@ -19,7 +19,7 @@
 
 package org.apache.james.quota.search.elasticsearch;
 
-import static org.apache.james.quota.search.elasticsearch.QuotaRatioElasticSearchConstants.QUOTA_RATIO_TYPE;
+import static org.apache.james.backends.es.QuotaRatioElasticSearchConstants.QUOTA_RATIO_TYPE;
 import static org.apache.james.quota.search.elasticsearch.json.JsonMessageConstants.USER;
 
 import java.util.Arrays;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3f6c0b9/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/QuotaRatioElasticSearchConstants.java
----------------------------------------------------------------------
diff --git a/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/QuotaRatioElasticSearchConstants.java b/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/QuotaRatioElasticSearchConstants.java
deleted file mode 100644
index 6ce049f..0000000
--- a/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/QuotaRatioElasticSearchConstants.java
+++ /dev/null
@@ -1,37 +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.james.quota.search.elasticsearch;
-
-import org.apache.james.backends.es.IndexName;
-import org.apache.james.backends.es.ReadAliasName;
-import org.apache.james.backends.es.TypeName;
-import org.apache.james.backends.es.WriteAliasName;
-
-public interface QuotaRatioElasticSearchConstants {
-
-    interface InjectionNames {
-        String QUOTA_RATIO = "quotaRatio";
-    }
-
-    WriteAliasName DEFAULT_QUOTA_RATIO_WRITE_ALIAS = new WriteAliasName("quotaRatioWriteAlias");
-    ReadAliasName DEFAULT_QUOTA_RATIO_READ_ALIAS = new ReadAliasName("quotaRatioReadAlias");
-    IndexName DEFAULT_QUOTA_RATIO_INDEX = new IndexName("quota_ratio_v1");
-    TypeName QUOTA_RATIO_TYPE = new TypeName("quotaRatio");
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3f6c0b9/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/QuotaRatioMappingFactory.java
----------------------------------------------------------------------
diff --git a/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/QuotaRatioMappingFactory.java b/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/QuotaRatioMappingFactory.java
index 128f1d1..096a8e5 100644
--- a/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/QuotaRatioMappingFactory.java
+++ b/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/QuotaRatioMappingFactory.java
@@ -32,6 +32,7 @@ import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
 
 import java.io.IOException;
 
+import org.apache.james.backends.es.QuotaRatioElasticSearchConstants;
 import org.elasticsearch.common.xcontent.XContentBuilder;
 
 public class QuotaRatioMappingFactory {

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3f6c0b9/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/QuotaSearchIndexCreationUtil.java
----------------------------------------------------------------------
diff --git a/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/QuotaSearchIndexCreationUtil.java b/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/QuotaSearchIndexCreationUtil.java
index 98a4698..a4a1103 100644
--- a/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/QuotaSearchIndexCreationUtil.java
+++ b/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/QuotaSearchIndexCreationUtil.java
@@ -23,6 +23,7 @@ import org.apache.james.backends.es.AliasName;
 import org.apache.james.backends.es.IndexCreationFactory;
 import org.apache.james.backends.es.IndexName;
 import org.apache.james.backends.es.NodeMappingFactory;
+import org.apache.james.backends.es.QuotaRatioElasticSearchConstants;
 import org.elasticsearch.client.Client;
 
 public class QuotaSearchIndexCreationUtil {

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3f6c0b9/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/events/ElasticSearchQuotaMailboxListener.java
----------------------------------------------------------------------
diff --git a/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/events/ElasticSearchQuotaMailboxListener.java b/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/events/ElasticSearchQuotaMailboxListener.java
index 1bdd295..6e7a1d0 100644
--- a/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/events/ElasticSearchQuotaMailboxListener.java
+++ b/mailbox/plugin/quota-search-elasticsearch/src/main/java/org/apache/james/quota/search/elasticsearch/events/ElasticSearchQuotaMailboxListener.java
@@ -22,10 +22,10 @@ import javax.inject.Inject;
 import javax.inject.Named;
 
 import org.apache.james.backends.es.ElasticSearchIndexer;
+import org.apache.james.backends.es.QuotaRatioElasticSearchConstants;
 import org.apache.james.mailbox.Event;
 import org.apache.james.mailbox.MailboxListener;
 import org.apache.james.mailbox.MailboxSession.User;
-import org.apache.james.quota.search.elasticsearch.QuotaRatioElasticSearchConstants;
 import org.apache.james.quota.search.elasticsearch.json.QuotaRatioToElasticSearchJson;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3f6c0b9/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/ElasticSearchQuotaSearchTestSystemExtension.java
----------------------------------------------------------------------
diff --git a/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/ElasticSearchQuotaSearchTestSystemExtension.java b/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/ElasticSearchQuotaSearchTestSystemExtension.java
index cf35a03..e38b37d 100644
--- a/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/ElasticSearchQuotaSearchTestSystemExtension.java
+++ b/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/ElasticSearchQuotaSearchTestSystemExtension.java
@@ -25,6 +25,7 @@ import java.util.concurrent.Executors;
 
 import org.apache.james.backends.es.ElasticSearchIndexer;
 import org.apache.james.backends.es.EmbeddedElasticSearch;
+import org.apache.james.backends.es.QuotaRatioElasticSearchConstants;
 import org.apache.james.backends.es.utils.TestingClientProvider;
 import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.domainlist.memory.MemoryDomainList;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3f6c0b9/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/events/ElasticSearchQuotaMailboxListenerTest.java
----------------------------------------------------------------------
diff --git a/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/events/ElasticSearchQuotaMailboxListenerTest.java b/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/events/ElasticSearchQuotaMailboxListenerTest.java
index a9ef7de..fa94dbe 100644
--- a/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/events/ElasticSearchQuotaMailboxListenerTest.java
+++ b/mailbox/plugin/quota-search-elasticsearch/src/test/java/org/apache/james/quota/search/elasticsearch/events/ElasticSearchQuotaMailboxListenerTest.java
@@ -35,7 +35,7 @@ import org.apache.james.mailbox.MailboxListener.QuotaUsageUpdatedEvent;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.quota.QuotaFixture.Counts;
 import org.apache.james.mailbox.quota.QuotaFixture.Sizes;
-import org.apache.james.quota.search.elasticsearch.QuotaRatioElasticSearchConstants;
+import org.apache.james.backends.es.QuotaRatioElasticSearchConstants;
 import org.apache.james.quota.search.elasticsearch.QuotaSearchIndexCreationUtil;
 import org.apache.james.quota.search.elasticsearch.json.QuotaRatioToElasticSearchJson;
 import org.elasticsearch.action.search.SearchResponse;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a3f6c0b9/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/host/ElasticSearchHostSystem.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/host/ElasticSearchHostSystem.java b/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/host/ElasticSearchHostSystem.java
index 7feed5d..93ce690 100644
--- a/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/host/ElasticSearchHostSystem.java
+++ b/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/host/ElasticSearchHostSystem.java
@@ -37,8 +37,8 @@ import org.apache.james.imap.main.DefaultImapDecoderFactory;
 import org.apache.james.imap.processor.main.DefaultImapProcessorFactory;
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver;
-import org.apache.james.mailbox.elasticsearch.IndexAttachments;
-import org.apache.james.mailbox.elasticsearch.MailboxElasticSearchConstants;
+import org.apache.james.backends.es.IndexAttachments;
+import org.apache.james.backends.es.MailboxElasticSearchConstants;
 import org.apache.james.mailbox.elasticsearch.MailboxIndexCreationUtil;
 import org.apache.james.mailbox.elasticsearch.events.ElasticSearchListeningMessageSearchIndex;
 import org.apache.james.mailbox.elasticsearch.json.MessageToElasticSearchJson;


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message