Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 5 additions & 15 deletions core/src/test/java/org/elasticsearch/get/GetActionIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -809,34 +809,24 @@ public void testUngeneratedFieldsThatAreAlwaysStored() throws IOException {
String createIndexSource = "{\n" +
" \"settings\": {\n" +
" \"index.translog.flush_threshold_size\": \"1pb\",\n" +
" \"index.mapping.single_type\": false," +
" \"refresh_interval\": \"-1\"\n" +
" },\n" +
" \"mappings\": {\n" +
" \"parentdoc\": {\n" +
" },\n" +
" \"doc\": {\n" +
" \"_parent\": {\n" +
" \"type\": \"parentdoc\"\n" +
" }\n" +
" }\n" +
" }\n" +
"}";
assertAcked(prepareCreate("test")
.addAlias(new Alias("alias")).setSource(createIndexSource, XContentType.JSON));
ensureGreen();

client().prepareIndex("test", "doc").setId("1").setSource("{}", XContentType.JSON).setParent("1").get();
client().prepareIndex("test", "doc", "1").setRouting("routingValue").setId("1").setSource("{}", XContentType.JSON).get();

String[] fieldsList = {"_parent"};
String[] fieldsList = {"_routing"};
// before refresh - document is only in translog
assertGetFieldsAlwaysWorks(indexOrAlias(), "doc", "1", fieldsList, "1");
assertGetFieldsAlwaysWorks(indexOrAlias(), "doc", "1", fieldsList, "routingValue");
refresh();
//after refresh - document is in translog and also indexed
assertGetFieldsAlwaysWorks(indexOrAlias(), "doc", "1", fieldsList, "1");
assertGetFieldsAlwaysWorks(indexOrAlias(), "doc", "1", fieldsList, "routingValue");
flush();
//after flush - document is in not anymore translog - only indexed
assertGetFieldsAlwaysWorks(indexOrAlias(), "doc", "1", fieldsList, "1");
assertGetFieldsAlwaysWorks(indexOrAlias(), "doc", "1", fieldsList, "routingValue");
}

public void testUngeneratedFieldsNotPartOfSourceStored() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ public void testDocValuesSingleType() throws Exception {
}

public void testDocValues(boolean singleType) throws IOException {
Settings indexSettings = Settings.builder()
.put("index.mapping.single_type", singleType)
Settings indexSettings = singleType ? Settings.EMPTY : Settings.builder()
.put("index.version.created", Version.V_5_6_0)
.build();
MapperService mapperService = createIndex("test", indexSettings).mapperService();
DocumentMapper mapper = mapperService.merge("type", new CompressedXContent("{\"type\":{}}"), MergeReason.MAPPING_UPDATE, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.elasticsearch.join.aggregations;

import org.apache.lucene.search.join.ScoreMode;
import org.elasticsearch.Version;
import org.elasticsearch.action.index.IndexRequestBuilder;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.update.UpdateResponse;
Expand Down Expand Up @@ -59,8 +60,11 @@
import static org.hamcrest.Matchers.sameInstance;

public class ChildrenIT extends ParentChildTestCase {


private static final Map<String, Control> categoryToControl = new HashMap<>();


@Before
public void setupCluster() throws Exception {
categoryToControl.clear();
Expand Down Expand Up @@ -321,7 +325,7 @@ public void testPostCollection() throws Exception {
prepareCreate(indexName)
.setSettings(Settings.builder().put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1)
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)
.put("index.mapping.single_type", false))
.put("index.version.created", Version.V_5_6_0)) // multi type
.addMapping(masterType, "brand", "type=text", "name", "type=keyword", "material", "type=text")
.addMapping(childType, "_parent", "type=masterprod", "color", "type=keyword", "size", "type=keyword")
);
Expand Down Expand Up @@ -396,7 +400,7 @@ public void testHierarchicalChildrenAggs() {
assertAcked(
prepareCreate(indexName)
.setSettings(Settings.builder()
.put("index.mapping.single_type", false)
.put("index.version.created", Version.V_5_6_0) // multi type
).addMapping(grandParentType, "name", "type=keyword")
.addMapping(parentType, "_parent", "type=" + grandParentType)
.addMapping(childType, "_parent", "type=" + parentType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ public class InnerHitsIT extends ParentChildTestCase {

@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
return Arrays.asList(ParentJoinPlugin.class, CustomScriptPlugin.class);
ArrayList<Class<? extends Plugin>> plugins = new ArrayList<>(super.nodePlugins());
plugins.add(CustomScriptPlugin.class);
return plugins;
}

public static class CustomScriptPlugin extends MockScriptPlugin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ protected void initializeAdditionalMappings(MapperService mapperService) throws
protected Settings indexSettings() {
return Settings.builder()
.put(super.indexSettings())
.put("index.mapping.single_type", false)
.put("index.version.created", Version.V_5_6_0) // multi type
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected Collection<Class<? extends Plugin>> getPlugins() {
protected Settings indexSettings() {
return Settings.builder()
.put(super.indexSettings())
.put("index.mapping.single_type", false)
.put("index.version.created", Version.V_5_6_0) // legacy needs multi types
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.apache.lucene.search.MatchNoDocsQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermQuery;
import org.elasticsearch.Version;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
import org.elasticsearch.common.compress.CompressedXContent;
import org.elasticsearch.common.settings.Settings;
Expand Down Expand Up @@ -58,7 +59,7 @@ protected Collection<Class<? extends Plugin>> getPlugins() {
protected Settings indexSettings() {
return Settings.builder()
.put(super.indexSettings())
.put("index.mapping.single_type", false)
.put("index.version.created", Version.V_5_6_0) // legacy needs multi type
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.elasticsearch.join.query;

import org.elasticsearch.Version;
import org.elasticsearch.action.index.IndexRequestBuilder;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder;
Expand All @@ -27,8 +28,10 @@
import org.elasticsearch.join.ParentJoinPlugin;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.InternalSettingsPlugin;

import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
Expand All @@ -44,7 +47,7 @@ protected boolean ignoreExternalCluster() {

@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
return Collections.singleton(ParentJoinPlugin.class);
return Arrays.asList(InternalSettingsPlugin.class, ParentJoinPlugin.class);
}

@Override
Expand All @@ -60,7 +63,7 @@ public Settings indexSettings() {
.put(IndexModule.INDEX_QUERY_CACHE_EVERYTHING_SETTING.getKey(), true);

if (legacy()) {
builder.put("index.mapping.single_type", false);
builder.put("index.version.created", Version.V_5_6_0);
}

return builder.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@

package org.elasticsearch.index.reindex;

import org.elasticsearch.Version;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.join.ParentJoinPlugin;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.InternalSettingsPlugin;

import java.util.ArrayList;
import java.util.Collection;
Expand Down Expand Up @@ -56,6 +58,7 @@ protected boolean ignoreExternalCluster() {
protected Collection<Class<? extends Plugin>> nodePlugins() {
final List<Class<? extends Plugin>> plugins = new ArrayList<>(super.nodePlugins());
plugins.add(ParentJoinPlugin.class);
plugins.add(InternalSettingsPlugin.class);
return Collections.unmodifiableList(plugins);
}

Expand Down Expand Up @@ -116,7 +119,7 @@ public void testErrorMessageWhenBadParentChild() throws Exception {
*/
private void createParentChildIndex(String indexName) throws Exception {
CreateIndexRequestBuilder create = client().admin().indices().prepareCreate(indexName);
create.setSettings("index.mapping.single_type", false);
create.setSettings("index.version.created", Version.V_5_6_0.id);
create.addMapping("city", "{\"_parent\": {\"type\": \"country\"}}", XContentType.JSON);
create.addMapping("neighborhood", "{\"_parent\": {\"type\": \"city\"}}", XContentType.JSON);
assertAcked(create);
Expand Down