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 @@ -51,6 +51,10 @@ public Set<NodeFeature> getFeatures() {
5151        );
5252    }
5353
54+     public  static  final  NodeFeature  CONSTANT_KEYWORD_SYNTHETIC_SOURCE_WRITE_FIX  = new  NodeFeature (
55+         "mapper.constant_keyword.synthetic_source_write_fix" 
56+     );
57+ 
5458    @ Override 
5559    public  Set <NodeFeature > getTestFeatures () {
5660        return  Set .of (
@@ -59,7 +63,8 @@ public Set<NodeFeature> getTestFeatures() {
5963            SourceFieldMapper .REMOVE_SYNTHETIC_SOURCE_ONLY_VALIDATION ,
6064            SourceFieldMapper .SOURCE_MODE_FROM_INDEX_SETTING ,
6165            IgnoredSourceFieldMapper .ALWAYS_STORE_OBJECT_ARRAYS_IN_NESTED_OBJECTS ,
62-             MapperService .LOGSDB_DEFAULT_IGNORE_DYNAMIC_BEYOND_LIMIT 
66+             MapperService .LOGSDB_DEFAULT_IGNORE_DYNAMIC_BEYOND_LIMIT ,
67+             CONSTANT_KEYWORD_SYNTHETIC_SOURCE_WRITE_FIX 
6368        );
6469    }
6570}
Original file line number Diff line number Diff line change 11import  org.elasticsearch.gradle.internal.info.BuildParams 
22
33apply plugin : ' elasticsearch.internal-es-plugin' 
4- apply plugin : ' elasticsearch.legacy -yaml-rest-test' 
4+ apply plugin : ' elasticsearch.internal -yaml-rest-test' 
55
66esplugin  {
77  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