- 
                Notifications
    
You must be signed in to change notification settings  - Fork 25.6k
 
Support Fields API in conditional ingest processors #121914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
            eyalkoren
  merged 33 commits into
  elastic:main
from
eyalkoren:support-dotted-fields-in-ingest-processors
  
      
      
   
  Jul 16, 2025 
      
    
  
     Merged
                    Changes from 15 commits
      Commits
    
    
            Show all changes
          
          
            33 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      080b1a6
              
                Support Fields API in conditional ingest processors
              
              
                eyalkoren ffba104
              
                Fixing whitelist
              
              
                eyalkoren 03a216b
              
                Fix access to dotted field from source in yaml test
              
              
                eyalkoren b70d222
              
                Merge remote-tracking branch 'upstream/main' into support-dotted-fiel…
              
              
                eyalkoren d7fbae9
              
                Merge remote-tracking branch 'upstream/main' into support-dotted-fiel…
              
              
                eyalkoren bfc1635
              
                Separate field access and field modification APIs
              
              
                eyalkoren b051a58
              
                Extending yaml test to cover all field access APIs
              
              
                eyalkoren e56d88d
              
                Separate WriteField and SourceMapField tests
              
              
                eyalkoren 3ad7f4c
              
                Add test verifying that iterator() API does not allow removal
              
              
                eyalkoren ae12f65
              
                Small test change
              
              
                eyalkoren 740ec51
              
                Merge remote-tracking branch 'upstream/main' into support-dotted-fiel…
              
              
                eyalkoren d25d892
              
                Merge remote-tracking branch 'upstream/main' into support-dotted-fiel…
              
              
                eyalkoren ac0d251
              
                Merge remote-tracking branch 'upstream/main' into support-dotted-fiel…
              
              
                eyalkoren bce9070
              
                Merge remote-tracking branch 'upstream/main' into support-dotted-fiel…
              
              
                eyalkoren b49f029
              
                Merge remote-tracking branch 'upstream/main' into support-dotted-fiel…
              
              
                eyalkoren 4979002
              
                Merge remote-tracking branch 'upstream/main' into support-dotted-fiel…
              
              
                eyalkoren cd9751b
              
                Caching script instance instead of script factory
              
              
                eyalkoren e9de9ce
              
                Update docs/changelog/121914.yaml
              
              
                eyalkoren 2c55cd3
              
                Merge remote-tracking branch 'upstream/main' into support-dotted-fiel…
              
              
                eyalkoren 31a08d7
              
                Merge remote-tracking branch 'upstream/main' into support-dotted-fiel…
              
              
                eyalkoren f55689d
              
                Initial review changes
              
              
                eyalkoren 8d2fc53
              
                Removing params from execute
              
              
                eyalkoren bc67d49
              
                Remove todo
              
              
                eyalkoren ce09705
              
                Removing Field's methods from whitelists
              
              
                eyalkoren 5a60385
              
                Merge remote-tracking branch 'upstream/main' into support-dotted-fiel…
              
              
                eyalkoren 62bb43d
              
                [CI] Auto commit changes from spotless
              
              
                 34ddc6e
              
                Merge branch 'main' into support-dotted-fields-in-ingest-processors
              
              
                eyalkoren 25a66d6
              
                Merge remote-tracking branch 'upstream/main' into support-dotted-fiel…
              
              
                eyalkoren 90cddcf
              
                Merge remote-tracking branch 'eyalkoren/support-dotted-fields-in-inge…
              
              
                eyalkoren bd5affd
              
                Merge branch 'main' into support-dotted-fields-in-ingest-processors
              
              
                eyalkoren 140ac66
              
                Merge remote-tracking branch 'upstream/main' into support-dotted-fiel…
              
              
                eyalkoren 45d0254
              
                Not relying on specific error type in yaml test
              
              
                eyalkoren 45a23e1
              
                Merge branch 'main' into support-dotted-fields-in-ingest-processors
              
              
                eyalkoren File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
  
    
      
          
            25 changes: 25 additions & 0 deletions
          
          25 
        
  ...n/resources/org/elasticsearch/painless/org.elasticsearch.script.processor_conditional.txt
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # | ||
| # Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| # or more contributor license agreements. Licensed under the "Elastic License | ||
| # 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
| # Public License v 1"; you may not use this file except in compliance with, at | ||
| # your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
| # License v3.0 only", or the "Server Side Public License, v 1". | ||
| # | ||
| 
     | 
||
| # This file contains a whitelist for conditional ingest scripts | ||
| 
     | 
||
| class org.elasticsearch.script.IngestConditionalScript { | ||
| SourceMapField field(String) | ||
| } | ||
| 
     | 
||
| class org.elasticsearch.script.field.SourceMapField { | ||
| String getName() | ||
| boolean exists() | ||
| boolean isEmpty() | ||
| int size() | ||
| Iterator iterator() | ||
| def get(def) | ||
| def get(int, def) | ||
| boolean hasValue(Predicate) | ||
| } | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
          
            40 changes: 40 additions & 0 deletions
          
          40 
        
  server/src/main/java/org/elasticsearch/script/SourceMapFieldScript.java
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the "Elastic License | ||
| * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
| * Public License v 1"; you may not use this file except in compliance with, at | ||
| * your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
| * License v3.0 only", or the "Server Side Public License, v 1". | ||
| */ | ||
| 
     | 
||
| package org.elasticsearch.script; | ||
| 
     | 
||
| import org.elasticsearch.script.field.SourceMapField; | ||
| 
     | 
||
| import java.util.Map; | ||
| 
     | 
||
| /** | ||
| * Abstract base class for scripts that read field values. | ||
| * These scripts provide {@code ctx} for backwards compatibility and expose {@link Metadata}. | ||
| */ | ||
| public abstract class SourceMapFieldScript { | ||
| protected final CtxMap<?> ctxMap; | ||
| 
     | 
||
| public SourceMapFieldScript(CtxMap<?> ctxMap) { | ||
| this.ctxMap = ctxMap; | ||
| } | ||
| 
     | 
||
| /** Provides backwards compatibility access to ctx */ | ||
| public Map<String, Object> getCtx() { | ||
| return ctxMap; | ||
| } | ||
| 
     | 
||
| /** Return the metadata for this script */ | ||
| public Metadata metadata() { | ||
                
      
                  eyalkoren marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| return ctxMap.getMetadata(); | ||
| } | ||
| 
     | 
||
| public SourceMapField field(String path) { | ||
| return new SourceMapField(path, ctxMap::getSource); | ||
| } | ||
| } | ||
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.