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>
<groupId>org.elasticsearch.plugin</groupId>
<artifactId>elasticsearch-plugin</artifactId>
<version>2.0.0-SNAPSHOT</version>
<artifactId>plugins</artifactId>
<version>2.0.0-beta1-SNAPSHOT</version>
</parent>
<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>

View File

@ -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<String, Object> 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 {

View File

@ -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<Class<? extends Module>> indexModules() {
Collection<Class<? extends Module>> modules = new ArrayList<>();
modules.add(AttachmentsIndexModule.class);
return modules;
public Collection<Module> indexModules(Settings indexSettings) {
return Collections.<Module>singletonList(new AttachmentsIndexModule());
}
}

View File

@ -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),