Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
2e7c5b3
feature: use synthetic recovery source by default for tsdb and logsdb
salvatore-campagna Dec 19, 2024
eb97654
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 8, 2025
116bab3
fix: default synthetic recovery source value
salvatore-campagna Jan 8, 2025
2bebd23
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 8, 2025
5c3507c
fix: handle null pointer exception
salvatore-campagna Jan 8, 2025
4677961
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 8, 2025
1f4bfed
fix: depend on mode setting
salvatore-campagna Jan 8, 2025
f21e8d4
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 8, 2025
3313218
fix: restore original code
salvatore-campagna Jan 8, 2025
6de37a8
nit: remove import MODE
salvatore-campagna Jan 8, 2025
a7ba43a
fix: remove unnecessary setting existence check
salvatore-campagna Jan 8, 2025
f6613d3
fix: move source mode setting to IndexSettings
salvatore-campagna Jan 8, 2025
7bcd751
fix: preserve histogram array in synthetic source
salvatore-campagna Jan 8, 2025
0cfda36
fix: missing _recovery_source field when using synthetic source
salvatore-campagna Jan 8, 2025
95e43e4
Revert "fix: preserve histogram array in synthetic source"
salvatore-campagna Jan 8, 2025
86df003
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 8, 2025
8dd466b
fix: disable testing for empty list
salvatore-campagna Jan 8, 2025
b2bbbf7
fix: exclude _recovery_source_size
salvatore-campagna Jan 9, 2025
1b6b524
fix: exclude _recovery_source_size
salvatore-campagna Jan 9, 2025
a8345c4
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 9, 2025
b87504d
fix: disable rest compatibility test after dropping _recovery_source …
salvatore-campagna Jan 9, 2025
cbb8d7f
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 9, 2025
278ab19
fix: no need to disable empty list test
salvatore-campagna Jan 9, 2025
6ee99fc
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 9, 2025
7118892
test: synthetic source recovery and source mode
salvatore-campagna Jan 9, 2025
d36a6ba
fix: false for bwc
salvatore-campagna Jan 10, 2025
8578832
fix: typo test vs text
salvatore-campagna Jan 10, 2025
6335465
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 10, 2025
2a50974
fix: setting is final
salvatore-campagna Jan 10, 2025
063531d
fix: synthetic recovery index version
salvatore-campagna Jan 10, 2025
73c9d9d
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 10, 2025
fff1fe4
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 10, 2025
8a6418a
fix: recover source field unvailable with synthetic source
salvatore-campagna Jan 10, 2025
4934292
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 10, 2025
b5ddc28
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 10, 2025
570ee9c
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 10, 2025
10d8b7d
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 10, 2025
b05e061
fix: synthetic recovery only for stateful
salvatore-campagna Jan 10, 2025
71f7186
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 10, 2025
1b03ddb
fix: no recovery source for stateless
salvatore-campagna Jan 10, 2025
aec53bb
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 10, 2025
300e942
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 10, 2025
08df011
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 13, 2025
7e74d4a
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 13, 2025
f705c83
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 13, 2025
65c9a0d
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 13, 2025
f3a892d
fix: remove stateless check
salvatore-campagna Jan 13, 2025
52df8c2
Revert "fix: remove stateless check"
salvatore-campagna Jan 14, 2025
3b38eb4
fix: remove serverless handling
salvatore-campagna Jan 14, 2025
b8ac5ae
fix: synthetic recovery source false in serverless
salvatore-campagna Jan 14, 2025
e999fa9
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 14, 2025
4fb4a07
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 14, 2025
fb302cf
Mute org.elasticsearch.repositories.s3.S3RepositoryThirdPartyTests or…
elasticsearchmachine Jan 14, 2025
d3c31d9
Mute org.elasticsearch.repositories.s3.RepositoryS3MinioBasicCredenti…
elasticsearchmachine Jan 14, 2025
61a563a
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 14, 2025
6754d36
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 14, 2025
ee5ae64
fix: introduce a feature flag to gate usage of synthetic recovery
salvatore-campagna Jan 30, 2025
e2f1926
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 30, 2025
fd2b1f0
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 30, 2025
9242373
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 30, 2025
2cf0ced
Revert "fix: recover source field unvailable with synthetic source"
salvatore-campagna Jan 30, 2025
62fb995
fix: check test result based on synthetic source recovery feature flag
salvatore-campagna Jan 30, 2025
201dff2
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 30, 2025
1814a5b
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 30, 2025
9936a10
fix: lucene version
salvatore-campagna Jan 30, 2025
49f4715
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 31, 2025
137e253
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 31, 2025
957fd47
fix: disable synthetic recovery yaml tests
salvatore-campagna Jan 31, 2025
a9ef0f5
fix: disable synthetic recovery yaml tests
salvatore-campagna Jan 31, 2025
c140cfb
fix: rename task
salvatore-campagna Jan 31, 2025
96502e3
fix: gate yaml test execution
salvatore-campagna Jan 31, 2025
fa9fd70
fix: use a better feature name and description
salvatore-campagna Jan 31, 2025
810ddbe
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 31, 2025
502c710
fix: push missing file
salvatore-campagna Jan 31, 2025
c56ec16
not: add a comment
salvatore-campagna Jan 31, 2025
5c2a1b9
fix: refactor feature selection logic
salvatore-campagna Jan 31, 2025
d865ff5
nit: avoid creating another static set
salvatore-campagna Jan 31, 2025
14997b7
fix: exclude tests from release build
salvatore-campagna Jan 31, 2025
ad7d742
fix: exlude from rest compatibility tests
salvatore-campagna Jan 31, 2025
7d0b3da
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 31, 2025
e99b549
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 31, 2025
e72b3a8
fix: try to disable tests
salvatore-campagna Jan 31, 2025
8fe2f3e
fix: use correct class
salvatore-campagna Jan 31, 2025
fc8d430
fix: restore previous feature name
salvatore-campagna Jan 31, 2025
4afd0fa
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 31, 2025
e70a02b
fix: test patch
salvatore-campagna Jan 31, 2025
09e523d
fix: add TODO to muted-tests
salvatore-campagna Jan 31, 2025
a7f0e9c
fix: add TODO to muted-tests
salvatore-campagna Jan 31, 2025
c9bbbcc
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Feb 3, 2025
bce5b19
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Feb 3, 2025
a532297
fix: yaml instead of p0
salvatore-campagna Feb 3, 2025
c44e096
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Feb 3, 2025
6d221e3
fix: missing backport version
salvatore-campagna Feb 3, 2025
98657ed
fix: try to exclude tests
salvatore-campagna Feb 3, 2025
c46b21d
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Feb 3, 2025
ee4e4f2
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Feb 4, 2025
ecd0b6c
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Feb 4, 2025
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
2 changes: 2 additions & 0 deletions rest-api-spec/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,6 @@ tasks.named("yamlRestCompatTestTransform").configure ({ task ->
task.skipTest("search.vectors/110_knn_query_with_filter/PRE_FILTER: pre-filter across multiple aliases", "waiting for #118774 backport")
task.skipTest("search.vectors/160_knn_query_missing_params/kNN search in a dis_max query - missing num_candidates", "waiting for #118774 backport")
task.skipTest("search.highlight/30_max_analyzed_offset/Plain highlighter with max_analyzed_offset < 0 should FAIL", "semantics of test has changed")
task.skipTest("update/100_synthetic_source/stored test", "After introducing #114618 _recovery_source field does not exist anymore when using synthetic source")
task.skipTest("update/100_synthetic_source/keyword", "After introducing #114618 _recovery_source field does not exist anymore when using synthetic source")
})
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ setup:
---
keyword:
- requires:
cluster_features: ["gte_v8.4.0"]
reason: introduced in 8.4.0
cluster_features: [ "mapper.synthetic_recovery_source" ]
reason: requires synthetic recovery source

- do:
indices.create:
Expand Down Expand Up @@ -60,13 +60,14 @@ keyword:
index: test
run_expensive_tasks: true
- is_false: test.fields._source
- is_true: test.fields._recovery_source
# When synthetic source is used there is no _recovery_source field
- match: { test.fields._recovery_source: null }

---
stored text:
- requires:
cluster_features: ["gte_v8.5.0"]
reason: introduced in 8.5.0
cluster_features: [ "mapper.synthetic_recovery_source" ]
reason: requires synthetic recovery source

- do:
indices.create:
Expand Down Expand Up @@ -121,4 +122,5 @@ stored text:
index: test
run_expensive_tasks: true
- is_false: test.fields._source
- is_true: test.fields._recovery_source
# When synthetic source is used there is no _recovery_source field
- match: { test.fields._recovery_source: null }
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.features.NodeFeature;
import org.elasticsearch.index.mapper.SourceFieldMapper;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.xcontent.ToXContentFragment;
import org.elasticsearch.xcontent.XContentBuilder;

Expand Down Expand Up @@ -71,7 +71,7 @@ public static MappingStats of(Metadata metadata, Runnable ensureNotCancelled) {
}
AnalysisStats.countMapping(mappingCounts, indexMetadata);

var sourceMode = SourceFieldMapper.INDEX_MAPPER_SOURCE_MODE_SETTING.get(indexMetadata.getSettings());
var sourceMode = IndexSettings.INDEX_MAPPER_SOURCE_MODE_SETTING.get(indexMetadata.getSettings());
sourceModeUsageCount.merge(sourceMode.toString().toLowerCase(Locale.ENGLISH), 1, Integer::sum);
}
final AtomicLong totalFieldCount = new AtomicLong();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
import org.elasticsearch.index.mapper.DocumentMapper;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.index.mapper.MapperService.MergeReason;
import org.elasticsearch.index.mapper.SourceFieldMapper;
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.indices.IndexCreationException;
import org.elasticsearch.indices.IndicesService;
Expand Down Expand Up @@ -1583,7 +1582,7 @@ static void validateCloneIndex(

private static final Set<String> UNMODIFIABLE_SETTINGS_DURING_RESIZE = Set.of(
IndexSettings.MODE.getKey(),
SourceFieldMapper.INDEX_MAPPER_SOURCE_MODE_SETTING.getKey(),
IndexSettings.INDEX_MAPPER_SOURCE_MODE_SETTING.getKey(),
IndexSettings.RECOVERY_USE_SYNTHETIC_SOURCE_SETTING.getKey(),
IndexSortConfig.INDEX_SORT_FIELD_SETTING.getKey(),
IndexSortConfig.INDEX_SORT_ORDER_SETTING.getKey(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import org.elasticsearch.index.mapper.IgnoredSourceFieldMapper;
import org.elasticsearch.index.mapper.InferenceMetadataFieldsMapper;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.index.mapper.SourceFieldMapper;
import org.elasticsearch.index.similarity.SimilarityService;
import org.elasticsearch.index.store.FsDirectoryFactory;
import org.elasticsearch.index.store.Store;
Expand Down Expand Up @@ -189,7 +188,7 @@ public final class IndexScopedSettings extends AbstractScopedSettings {
FieldMapper.SYNTHETIC_SOURCE_KEEP_INDEX_SETTING,
IgnoredSourceFieldMapper.SKIP_IGNORED_SOURCE_WRITE_SETTING,
IgnoredSourceFieldMapper.SKIP_IGNORED_SOURCE_READ_SETTING,
SourceFieldMapper.INDEX_MAPPER_SOURCE_MODE_SETTING,
IndexSettings.INDEX_MAPPER_SOURCE_MODE_SETTING,
IndexSettings.RECOVERY_USE_SYNTHETIC_SOURCE_SETTING,
InferenceMetadataFieldsMapper.USE_LEGACY_SEMANTIC_TEXT_FORMAT,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1569,6 +1569,15 @@ public static Setting<Boolean> boolSetting(String key, boolean defaultValue, Val
return new Setting<>(key, Boolean.toString(defaultValue), booleanParser(key, properties), validator, properties);
}

public static Setting<Boolean> boolSetting(
String key,
Function<Settings, String> defaultValueFn,
Validator<Boolean> validator,
Property... properties
) {
return new Setting<>(key, defaultValueFn, booleanParser(key, properties), validator, properties);
}

public static Setting<Boolean> boolSetting(String key, Function<Settings, String> defaultValueFn, Property... properties) {
return new Setting<>(key, defaultValueFn, booleanParser(key, properties), properties);
}
Expand Down
98 changes: 56 additions & 42 deletions server/src/main/java/org/elasticsearch/index/IndexSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
import static org.elasticsearch.index.mapper.MapperService.INDEX_MAPPING_NESTED_DOCS_LIMIT_SETTING;
import static org.elasticsearch.index.mapper.MapperService.INDEX_MAPPING_NESTED_FIELDS_LIMIT_SETTING;
import static org.elasticsearch.index.mapper.MapperService.INDEX_MAPPING_TOTAL_FIELDS_LIMIT_SETTING;
import static org.elasticsearch.index.mapper.SourceFieldMapper.INDEX_MAPPER_SOURCE_MODE_SETTING;

/**
* This class encapsulates all index level settings and handles settings updates.
Expand Down Expand Up @@ -655,9 +654,64 @@ public Iterator<Setting<?>> settings() {
Property.Final
);

/**
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is just a result of reordering settings in such a way that static initialization happens in the right order.

* Returns <code>true</code> if TSDB encoding is enabled. The default is <code>true</code>
*/
public boolean isES87TSDBCodecEnabled() {
return es87TSDBCodecEnabled;
}

public static final Setting<Boolean> LOGSDB_ROUTE_ON_SORT_FIELDS = Setting.boolSetting(
"index.logsdb.route_on_sort_fields",
false,
Property.IndexScope,
Property.Final
);

/**
* The {@link IndexMode "mode"} of the index.
*/
public static final Setting<IndexMode> MODE = Setting.enumSetting(
IndexMode.class,
"index.mode",
IndexMode.STANDARD,
new Setting.Validator<>() {
@Override
public void validate(IndexMode value) {}

@Override
public void validate(IndexMode value, Map<Setting<?>, Object> settings) {
value.validateWithOtherSettings(settings);
}

@Override
public Iterator<Setting<?>> settings() {
return IndexMode.VALIDATE_WITH_SETTINGS.iterator();
}
},
Property.IndexScope,
Property.Final,
Property.ServerlessPublic
);

public static final Setting<SourceFieldMapper.Mode> INDEX_MAPPER_SOURCE_MODE_SETTING = Setting.enumSetting(
SourceFieldMapper.Mode.class,
settings -> {
final IndexMode indexMode = IndexSettings.MODE.get(settings);
return indexMode.defaultSourceMode().name();
},
"index.mapping.source.mode",
value -> {},
Setting.Property.Final,
Setting.Property.IndexScope
);

public static final Setting<Boolean> RECOVERY_USE_SYNTHETIC_SOURCE_SETTING = Setting.boolSetting(
"index.recovery.use_synthetic_source",
false,
settings -> {
final SourceFieldMapper.Mode sourceMode = INDEX_MAPPER_SOURCE_MODE_SETTING.get(settings);
return String.valueOf(sourceMode == SourceFieldMapper.Mode.SYNTHETIC);
},
new Setting.Validator<>() {
@Override
public void validate(Boolean value) {}
Expand Down Expand Up @@ -697,46 +751,6 @@ public Iterator<Setting<?>> settings() {
Property.Final
);

/**
* Returns <code>true</code> if TSDB encoding is enabled. The default is <code>true</code>
*/
public boolean isES87TSDBCodecEnabled() {
return es87TSDBCodecEnabled;
}

public static final Setting<Boolean> LOGSDB_ROUTE_ON_SORT_FIELDS = Setting.boolSetting(
"index.logsdb.route_on_sort_fields",
false,
Property.IndexScope,
Property.Final
);

/**
* The {@link IndexMode "mode"} of the index.
*/
public static final Setting<IndexMode> MODE = Setting.enumSetting(
IndexMode.class,
"index.mode",
IndexMode.STANDARD,
new Setting.Validator<>() {
@Override
public void validate(IndexMode value) {}

@Override
public void validate(IndexMode value, Map<Setting<?>, Object> settings) {
value.validateWithOtherSettings(settings);
}

@Override
public Iterator<Setting<?>> settings() {
return IndexMode.VALIDATE_WITH_SETTINGS.iterator();
}
},
Property.IndexScope,
Property.Final,
Property.ServerlessPublic
);

/**
* Legacy index setting, kept for 7.x BWC compatibility. This setting has no effect in 8.x. Do not use.
* TODO: Remove in 9.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import org.elasticsearch.common.Explicit;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.CollectionUtils;
import org.elasticsearch.core.Nullable;
Expand Down Expand Up @@ -67,11 +66,6 @@ public class SourceFieldMapper extends MetadataFieldMapper {

public static final String LOSSY_PARAMETERS_ALLOWED_SETTING_NAME = "index.lossy.source-mapping-parameters";

public static final Setting<Mode> INDEX_MAPPER_SOURCE_MODE_SETTING = Setting.enumSetting(SourceFieldMapper.Mode.class, settings -> {
final IndexMode indexMode = IndexSettings.MODE.get(settings);
return indexMode.defaultSourceMode().name();
}, "index.mapping.source.mode", value -> {}, Setting.Property.Final, Setting.Property.IndexScope);

public static final String DEPRECATION_WARNING = "Configuring source mode in mappings is deprecated and will be removed "
+ "in future versions. Use [index.mapping.source.mode] index setting instead.";

Expand Down Expand Up @@ -261,8 +255,8 @@ public SourceFieldMapper build() {
private Mode resolveSourceMode() {
// If the `index.mapping.source.mode` exists it takes precedence to determine the source mode for `_source`
// otherwise the mode is determined according to `_source.mode`.
if (INDEX_MAPPER_SOURCE_MODE_SETTING.exists(settings)) {
return INDEX_MAPPER_SOURCE_MODE_SETTING.get(settings);
if (IndexSettings.INDEX_MAPPER_SOURCE_MODE_SETTING.exists(settings)) {
return IndexSettings.INDEX_MAPPER_SOURCE_MODE_SETTING.get(settings);
}

// If `_source.mode` is not set we need to apply a default according to index mode.
Expand Down Expand Up @@ -294,7 +288,7 @@ private static SourceFieldMapper resolveStaticInstance(final Mode sourceMode) {
return DEFAULT;
}

final Mode settingSourceMode = INDEX_MAPPER_SOURCE_MODE_SETTING.get(c.getSettings());
final Mode settingSourceMode = IndexSettings.INDEX_MAPPER_SOURCE_MODE_SETTING.get(c.getSettings());
// Needed for bwc so that "mode" is not serialized in case of standard index with stored source.
if (indexMode == IndexMode.STANDARD && settingSourceMode == Mode.STORED) {
return DEFAULT;
Expand Down Expand Up @@ -479,11 +473,11 @@ public boolean isSynthetic() {
}

public static boolean isSynthetic(IndexSettings indexSettings) {
return INDEX_MAPPER_SOURCE_MODE_SETTING.get(indexSettings.getSettings()) == SourceFieldMapper.Mode.SYNTHETIC;
return IndexSettings.INDEX_MAPPER_SOURCE_MODE_SETTING.get(indexSettings.getSettings()) == SourceFieldMapper.Mode.SYNTHETIC;
}

public static boolean isStored(IndexSettings indexSettings) {
return INDEX_MAPPER_SOURCE_MODE_SETTING.get(indexSettings.getSettings()) == Mode.STORED;
return IndexSettings.INDEX_MAPPER_SOURCE_MODE_SETTING.get(indexSettings.getSettings()) == Mode.STORED;
}

public boolean isDisabled() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
import org.elasticsearch.index.IndexVersion;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.index.mapper.Mapping;
import org.elasticsearch.index.mapper.SourceFieldMapper;
import org.elasticsearch.index.shard.IndexLongFieldRange;
import org.elasticsearch.index.shard.IndexShard;
import org.elasticsearch.index.shard.ShardId;
Expand Down Expand Up @@ -158,7 +157,7 @@ public final class RestoreService implements ClusterStateApplier {
SETTING_CREATION_DATE,
SETTING_HISTORY_UUID,
IndexSettings.MODE.getKey(),
SourceFieldMapper.INDEX_MAPPER_SOURCE_MODE_SETTING.getKey(),
IndexSettings.INDEX_MAPPER_SOURCE_MODE_SETTING.getKey(),
IndexSettings.RECOVERY_USE_SYNTHETIC_SOURCE_SETTING.getKey(),
IndexSortConfig.INDEX_SORT_FIELD_SETTING.getKey(),
IndexSortConfig.INDEX_SORT_ORDER_SETTING.getKey(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.Writeable.Reader;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.IndexVersion;
import org.elasticsearch.index.mapper.SourceFieldMapper;
import org.elasticsearch.script.Script;
import org.elasticsearch.tasks.TaskCancelledException;
import org.elasticsearch.test.AbstractWireSerializingTestCase;
Expand Down Expand Up @@ -586,15 +586,15 @@ public void testSourceModes() {
int numDisabledIndices = randomIntBetween(1, 5);
for (int i = 0; i < numSyntheticIndices; i++) {
IndexMetadata.Builder indexMetadata = new IndexMetadata.Builder("foo-synthetic-" + i).settings(
indexSettings(IndexVersion.current(), 4, 1).put(SourceFieldMapper.INDEX_MAPPER_SOURCE_MODE_SETTING.getKey(), "synthetic")
indexSettings(IndexVersion.current(), 4, 1).put(IndexSettings.INDEX_MAPPER_SOURCE_MODE_SETTING.getKey(), "synthetic")
);
builder.put(indexMetadata);
}
for (int i = 0; i < numStoredIndices; i++) {
IndexMetadata.Builder indexMetadata;
if (randomBoolean()) {
indexMetadata = new IndexMetadata.Builder("foo-stored-" + i).settings(
indexSettings(IndexVersion.current(), 4, 1).put(SourceFieldMapper.INDEX_MAPPER_SOURCE_MODE_SETTING.getKey(), "stored")
indexSettings(IndexVersion.current(), 4, 1).put(IndexSettings.INDEX_MAPPER_SOURCE_MODE_SETTING.getKey(), "stored")
);
} else {
indexMetadata = new IndexMetadata.Builder("foo-stored-" + i).settings(indexSettings(IndexVersion.current(), 4, 1));
Expand All @@ -603,7 +603,7 @@ public void testSourceModes() {
}
for (int i = 0; i < numDisabledIndices; i++) {
IndexMetadata.Builder indexMetadata = new IndexMetadata.Builder("foo-disabled-" + i).settings(
indexSettings(IndexVersion.current(), 4, 1).put(SourceFieldMapper.INDEX_MAPPER_SOURCE_MODE_SETTING.getKey(), "disabled")
indexSettings(IndexVersion.current(), 4, 1).put(IndexSettings.INDEX_MAPPER_SOURCE_MODE_SETTING.getKey(), "disabled")
);
builder.put(indexMetadata);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@

import java.io.IOException;

import static org.elasticsearch.index.mapper.SourceFieldMapper.INDEX_MAPPER_SOURCE_MODE_SETTING;

public class LuceneSyntheticSourceChangesSnapshotTests extends SearchBasedChangesSnapshotTests {
@Override
protected Settings indexSettings() {
return Settings.builder()
.put(super.indexSettings())
.put(INDEX_MAPPER_SOURCE_MODE_SETTING.getKey(), SourceFieldMapper.Mode.SYNTHETIC.name())
.put(IndexSettings.INDEX_MAPPER_SOURCE_MODE_SETTING.getKey(), SourceFieldMapper.Mode.SYNTHETIC.name())
.put(IndexSettings.RECOVERY_USE_SYNTHETIC_SOURCE_SETTING.getKey(), true)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@

import java.io.IOException;

import static org.elasticsearch.index.mapper.SourceFieldMapper.INDEX_MAPPER_SOURCE_MODE_SETTING;

public class TranslogOperationAsserterTests extends EngineTestCase {

@Override
protected Settings indexSettings() {
return Settings.builder()
.put(super.indexSettings())
.put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true)
.put(INDEX_MAPPER_SOURCE_MODE_SETTING.getKey(), SourceFieldMapper.Mode.SYNTHETIC.name())
.put(IndexSettings.INDEX_MAPPER_SOURCE_MODE_SETTING.getKey(), SourceFieldMapper.Mode.SYNTHETIC.name())
.put(IndexSettings.RECOVERY_USE_SYNTHETIC_SOURCE_SETTING.getKey(), true)
.build();
}
Expand All @@ -57,10 +55,10 @@ EngineConfig engineConfig(boolean useSyntheticSource) {
EngineConfig config = engine.config();
Settings.Builder settings = Settings.builder().put(config.getIndexSettings().getSettings());
if (useSyntheticSource) {
settings.put(INDEX_MAPPER_SOURCE_MODE_SETTING.getKey(), SourceFieldMapper.Mode.SYNTHETIC.name());
settings.put(IndexSettings.INDEX_MAPPER_SOURCE_MODE_SETTING.getKey(), SourceFieldMapper.Mode.SYNTHETIC.name());
settings.put(IndexSettings.RECOVERY_USE_SYNTHETIC_SOURCE_SETTING.getKey(), true);
} else {
settings.put(INDEX_MAPPER_SOURCE_MODE_SETTING.getKey(), SourceFieldMapper.Mode.STORED.name());
settings.put(IndexSettings.INDEX_MAPPER_SOURCE_MODE_SETTING.getKey(), SourceFieldMapper.Mode.STORED.name());
settings.put(IndexSettings.RECOVERY_USE_SYNTHETIC_SOURCE_SETTING.getKey(), false);
}
IndexMetadata imd = IndexMetadata.builder(config.getIndexSettings().getIndexMetadata()).settings(settings).build();
Expand Down
Loading