File tree Expand file tree Collapse file tree 4 files changed +41
-4
lines changed
server/src/main/java/org/elasticsearch/index/mapper
x-pack/plugin/mapper-constant-keyword
java/org/elasticsearch/xpack/constantkeyword
resources/rest-api-spec/test Expand file tree Collapse file tree 4 files changed +41
-4
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,10 @@ public Set<NodeFeature> getFeatures() {
5757 );
5858 }
5959
60+ public static final NodeFeature CONSTANT_KEYWORD_SYNTHETIC_SOURCE_WRITE_FIX = new NodeFeature (
61+ "mapper.constant_keyword.synthetic_source_write_fix"
62+ );
63+
6064 @ Override
6165 public Set <NodeFeature > getTestFeatures () {
6266 return Set .of (
@@ -66,7 +70,8 @@ public Set<NodeFeature> getTestFeatures() {
6670 SourceFieldMapper .SOURCE_MODE_FROM_INDEX_SETTING ,
6771 IgnoredSourceFieldMapper .IGNORED_SOURCE_AS_TOP_LEVEL_METADATA_ARRAY_FIELD ,
6872 IgnoredSourceFieldMapper .ALWAYS_STORE_OBJECT_ARRAYS_IN_NESTED_OBJECTS ,
69- MapperService .LOGSDB_DEFAULT_IGNORE_DYNAMIC_BEYOND_LIMIT
73+ MapperService .LOGSDB_DEFAULT_IGNORE_DYNAMIC_BEYOND_LIMIT ,
74+ CONSTANT_KEYWORD_SYNTHETIC_SOURCE_WRITE_FIX
7075 );
7176 }
7277}
Original file line number Diff line number Diff line change 66 */
77
88apply plugin : ' elasticsearch.internal-es-plugin'
9- apply plugin : ' elasticsearch.legacy -yaml-rest-test'
9+ apply plugin : ' elasticsearch.internal -yaml-rest-test'
1010
1111esplugin {
1212 name ' constant-keyword'
Original file line number Diff line number Diff line change 1010import com .carrotsearch .randomizedtesting .annotations .Name ;
1111import com .carrotsearch .randomizedtesting .annotations .ParametersFactory ;
1212
13+ import org .elasticsearch .test .cluster .ElasticsearchCluster ;
1314import org .elasticsearch .test .rest .yaml .ClientYamlTestCandidate ;
1415import org .elasticsearch .test .rest .yaml .ESClientYamlSuiteTestCase ;
16+ import org .junit .ClassRule ;
1517
1618/** Runs yaml rest tests */
1719public class ConstantKeywordClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
@@ -24,4 +26,12 @@ public ConstantKeywordClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidat
2426 public static Iterable <Object []> parameters () throws Exception {
2527 return ESClientYamlSuiteTestCase .createParameters ();
2628 }
29+
30+ @ ClassRule
31+ public static ElasticsearchCluster cluster = ElasticsearchCluster .local ().module ("constant-keyword" ).build ();
32+
33+ @ Override
34+ protected String getTestRestCluster () {
35+ return cluster .getHttpAddresses ();
36+ }
2737}
Original file line number Diff line number Diff line change 11constant_keyword :
22 - requires :
3- cluster_features : [ "mapper.source.mode_from_index_setting " ]
4- reason : " Source mode configured through index setting "
3+ cluster_features : [ "mapper.constant_keyword.synthetic_source_write_fix " ]
4+ reason : " Behavior fix "
55
66 - do :
77 indices.create :
@@ -26,13 +26,35 @@ constant_keyword:
2626 body :
2727 kwd : foo
2828
29+ - do :
30+ index :
31+ index : test
32+ id : 2
33+ refresh : true
34+ body :
35+ kwd : foo
36+ const_kwd : bar
37+
2938 - do :
3039 search :
3140 index : test
3241 body :
3342 query :
3443 ids :
3544 values : [1]
45+
46+ - match :
47+ hits.hits.0._source :
48+ kwd : foo
49+
50+ - do :
51+ search :
52+ index : test
53+ body :
54+ query :
55+ ids :
56+ values : [2]
57+
3658 - match :
3759 hits.hits.0._source :
3860 kwd : foo
You can’t perform that action at this time.
0 commit comments