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)
This commit is contained in:
David Pilato 2015-08-24 17:21:38 +02:00
parent 348b05a50e
commit 38ae04230a
4 changed files with 13 additions and 15 deletions

View File

@ -26,12 +26,12 @@
<parent> <parent>
<groupId>org.elasticsearch.plugin</groupId> <groupId>org.elasticsearch.plugin</groupId>
<artifactId>elasticsearch-plugin</artifactId> <artifactId>plugins</artifactId>
<version>2.0.0-SNAPSHOT</version> <version>2.0.0-beta1-SNAPSHOT</version>
</parent> </parent>
<properties> <properties>
<elasticsearch.version>2.0.0-SNAPSHOT</elasticsearch.version> <elasticsearch.version>2.0.0-beta1-SNAPSHOT</elasticsearch.version>
<elasticsearch.plugin.classname>org.elasticsearch.plugin.mapper.attachments.MapperAttachmentsPlugin</elasticsearch.plugin.classname> <elasticsearch.plugin.classname>org.elasticsearch.plugin.mapper.attachments.MapperAttachmentsPlugin</elasticsearch.plugin.classname>

View File

@ -200,7 +200,7 @@ public class AttachmentMapper extends FieldMapper {
context.path().pathType(pathType); context.path().pathType(pathType);
FieldMapper contentMapper; 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 // old behavior, we need the content to be indexed under the attachment field name
if (contentBuilder instanceof FieldMapper.Builder == false) { if (contentBuilder instanceof FieldMapper.Builder == false) {
throw new IllegalStateException("content field for attachment must be a field mapper"); throw new IllegalStateException("content field for attachment must be a field mapper");
@ -313,7 +313,7 @@ public class AttachmentMapper extends FieldMapper {
Map.Entry<String, Object> entry = iterator.next(); Map.Entry<String, Object> entry = iterator.next();
String fieldName = entry.getKey(); String fieldName = entry.getKey();
Object fieldNode = entry.getValue(); 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())); builder.pathType(parsePathType(name, fieldNode.toString()));
iterator.remove(); iterator.remove();
} else if (fieldName.equals("fields")) { } else if (fieldName.equals("fields")) {
@ -326,7 +326,7 @@ public class AttachmentMapper extends FieldMapper {
Mapper.Builder<?, ?> mapperBuilder = findMapperBuilder(propNode, propName, parserContext); Mapper.Builder<?, ?> mapperBuilder = findMapperBuilder(propNode, propName, parserContext);
if (parseMultiField((FieldMapper.Builder) mapperBuilder, fieldName, parserContext, propName, propNode)) { if (parseMultiField((FieldMapper.Builder) mapperBuilder, fieldName, parserContext, propName, propNode)) {
fieldsIterator.remove(); 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); builder.content(mapperBuilder);
fieldsIterator.remove(); fieldsIterator.remove();
} else { } else {

View File

@ -20,15 +20,16 @@
package org.elasticsearch.plugin.mapper.attachments; package org.elasticsearch.plugin.mapper.attachments;
import org.elasticsearch.common.inject.Module; 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.Collection;
import java.util.Collections;
/** /**
* *
*/ */
public class MapperAttachmentsPlugin extends AbstractPlugin { public class MapperAttachmentsPlugin extends Plugin {
@Override @Override
public String name() { public String name() {
@ -41,9 +42,7 @@ public class MapperAttachmentsPlugin extends AbstractPlugin {
} }
@Override @Override
public Collection<Class<? extends Module>> indexModules() { public Collection<Module> indexModules(Settings indexSettings) {
Collection<Class<? extends Module>> modules = new ArrayList<>(); return Collections.<Module>singletonList(new AttachmentsIndexModule());
modules.add(AttachmentsIndexModule.class);
return modules;
} }
} }

View File

@ -36,7 +36,6 @@ import org.elasticsearch.index.mapper.DocumentMapperParser;
import org.elasticsearch.index.mapper.MapperService; import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.index.settings.IndexSettingsModule; import org.elasticsearch.index.settings.IndexSettingsModule;
import org.elasticsearch.index.similarity.SimilarityLookupService; import org.elasticsearch.index.similarity.SimilarityLookupService;
import org.elasticsearch.indices.analysis.IndicesAnalysisModule;
import org.elasticsearch.indices.analysis.IndicesAnalysisService; import org.elasticsearch.indices.analysis.IndicesAnalysisService;
import java.nio.file.Path; import java.nio.file.Path;
@ -70,7 +69,7 @@ public class MapperTestUtils {
} }
public static AnalysisService newAnalysisService(Settings indexSettings) { 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"); Index index = new Index("test");
Injector injector = new ModulesBuilder().add( Injector injector = new ModulesBuilder().add(
new IndexSettingsModule(index, indexSettings), new IndexSettingsModule(index, indexSettings),