From 38ae04230a100fdfc899c5ab66a3b1ea4268c4e7 Mon Sep 17 00:00:00 2001 From: David Pilato Date: Mon, 24 Aug 2015 17:21:38 +0200 Subject: [PATCH] Update to 2.0.0.beta1 Note this PR requires for now https://github.com/elastic/elasticsearch/pull/13001 to be merged in branch 2.0. It sounds like it's not required for master branch (2.1.0-SNAPSHOT) --- pom.xml | 6 +++--- .../index/mapper/attachment/AttachmentMapper.java | 6 +++--- .../mapper/attachments/MapperAttachmentsPlugin.java | 13 ++++++------- .../mapper/attachment/test/MapperTestUtils.java | 3 +-- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index 0474c05199e..bea58e0dc4c 100644 --- a/pom.xml +++ b/pom.xml @@ -26,12 +26,12 @@ org.elasticsearch.plugin - elasticsearch-plugin - 2.0.0-SNAPSHOT + plugins + 2.0.0-beta1-SNAPSHOT - 2.0.0-SNAPSHOT + 2.0.0-beta1-SNAPSHOT org.elasticsearch.plugin.mapper.attachments.MapperAttachmentsPlugin diff --git a/src/main/java/org/elasticsearch/index/mapper/attachment/AttachmentMapper.java b/src/main/java/org/elasticsearch/index/mapper/attachment/AttachmentMapper.java index e034f4caa67..c892924dffa 100644 --- a/src/main/java/org/elasticsearch/index/mapper/attachment/AttachmentMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/attachment/AttachmentMapper.java @@ -200,7 +200,7 @@ public class AttachmentMapper extends FieldMapper { context.path().pathType(pathType); FieldMapper contentMapper; - if (context.indexCreatedVersion().before(Version.V_2_0_0)) { + if (context.indexCreatedVersion().before(Version.V_2_0_0_beta1)) { // old behavior, we need the content to be indexed under the attachment field name if (contentBuilder instanceof FieldMapper.Builder == false) { throw new IllegalStateException("content field for attachment must be a field mapper"); @@ -313,7 +313,7 @@ public class AttachmentMapper extends FieldMapper { Map.Entry entry = iterator.next(); String fieldName = entry.getKey(); Object fieldNode = entry.getValue(); - if (fieldName.equals("path") && parserContext.indexVersionCreated().before(Version.V_2_0_0)) { + if (fieldName.equals("path") && parserContext.indexVersionCreated().before(Version.V_2_0_0_beta1)) { builder.pathType(parsePathType(name, fieldNode.toString())); iterator.remove(); } else if (fieldName.equals("fields")) { @@ -326,7 +326,7 @@ public class AttachmentMapper extends FieldMapper { Mapper.Builder mapperBuilder = findMapperBuilder(propNode, propName, parserContext); if (parseMultiField((FieldMapper.Builder) mapperBuilder, fieldName, parserContext, propName, propNode)) { fieldsIterator.remove(); - } else if (propName.equals(name) && parserContext.indexVersionCreated().before(Version.V_2_0_0)) { + } else if (propName.equals(name) && parserContext.indexVersionCreated().before(Version.V_2_0_0_beta1)) { builder.content(mapperBuilder); fieldsIterator.remove(); } else { diff --git a/src/main/java/org/elasticsearch/plugin/mapper/attachments/MapperAttachmentsPlugin.java b/src/main/java/org/elasticsearch/plugin/mapper/attachments/MapperAttachmentsPlugin.java index c5555c5c639..f5673d7815a 100644 --- a/src/main/java/org/elasticsearch/plugin/mapper/attachments/MapperAttachmentsPlugin.java +++ b/src/main/java/org/elasticsearch/plugin/mapper/attachments/MapperAttachmentsPlugin.java @@ -20,15 +20,16 @@ package org.elasticsearch.plugin.mapper.attachments; import org.elasticsearch.common.inject.Module; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.plugins.Plugin; -import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; /** * */ -public class MapperAttachmentsPlugin extends AbstractPlugin { +public class MapperAttachmentsPlugin extends Plugin { @Override public String name() { @@ -41,9 +42,7 @@ public class MapperAttachmentsPlugin extends AbstractPlugin { } @Override - public Collection> indexModules() { - Collection> modules = new ArrayList<>(); - modules.add(AttachmentsIndexModule.class); - return modules; + public Collection indexModules(Settings indexSettings) { + return Collections.singletonList(new AttachmentsIndexModule()); } } diff --git a/src/test/java/org/elasticsearch/index/mapper/attachment/test/MapperTestUtils.java b/src/test/java/org/elasticsearch/index/mapper/attachment/test/MapperTestUtils.java index 573c1f35e66..7f73d4313d3 100644 --- a/src/test/java/org/elasticsearch/index/mapper/attachment/test/MapperTestUtils.java +++ b/src/test/java/org/elasticsearch/index/mapper/attachment/test/MapperTestUtils.java @@ -36,7 +36,6 @@ import org.elasticsearch.index.mapper.DocumentMapperParser; import org.elasticsearch.index.mapper.MapperService; import org.elasticsearch.index.settings.IndexSettingsModule; import org.elasticsearch.index.similarity.SimilarityLookupService; -import org.elasticsearch.indices.analysis.IndicesAnalysisModule; import org.elasticsearch.indices.analysis.IndicesAnalysisService; import java.nio.file.Path; @@ -70,7 +69,7 @@ public class MapperTestUtils { } public static AnalysisService newAnalysisService(Settings indexSettings) { - Injector parentInjector = new ModulesBuilder().add(new SettingsModule(indexSettings), new EnvironmentModule(new Environment(indexSettings)), new IndicesAnalysisModule()).createInjector(); + Injector parentInjector = new ModulesBuilder().add(new SettingsModule(indexSettings), new EnvironmentModule(new Environment(indexSettings))).createInjector(); Index index = new Index("test"); Injector injector = new ModulesBuilder().add( new IndexSettingsModule(index, indexSettings),