Class BlockLoader.ConditionalBlockLoader

java.lang.Object
org.elasticsearch.index.mapper.BlockLoader.ConditionalBlockLoader
All Implemented Interfaces:
BlockLoader
Direct Known Subclasses:
TextFamilyFieldType.ConditionalBlockLoaderWithIgnoreField
Enclosing interface:
BlockLoader

public abstract static class BlockLoader.ConditionalBlockLoader extends Object implements BlockLoader
A BlockLoader that conditionally selects one of two underlying loaders based on the underlying data. It prefers the preferLoader when possible, falling back to the fallbackLoader otherwise.

For example, a text field with a synthetic source can be loaded from its child keyword field when possible, which is faster than loading from stored fields:

 {
     "parent_text_field": {
         "type": "text",
         "fields": {
             "child_keyword_field": {
                 "type": "keyword",
                 "ignore_above": 256
             }
         }
     }
 }
 
If no values in a segment exceed the 256-character limit, then we can safely use the block loader from the keyword field for the entire segment. Alternatively, on a per-document basis, if doc-1 has the value "a" (under the limit) and doc-2 has the value "bcd..." (exceeds the limit), we can load doc-1 from the doc_values of keyword field and doc-2 from the slower stored fields.