org.elasticsearch.index.mapper.ValueFetcher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of elasticsearch Show documentation
Show all versions of elasticsearch Show documentation
Elasticsearch - Open Source, Distributed, RESTful Search Engine
/*
* 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 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 or the Server
* Side Public License, v 1.
*/
package org.elasticsearch.index.mapper;
import org.apache.lucene.index.LeafReaderContext;
import org.elasticsearch.common.document.DocumentField;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.search.fetch.StoredFieldsSpec;
import org.elasticsearch.search.fetch.subphase.FetchFieldsPhase;
import org.elasticsearch.search.lookup.Source;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* A helper class for fetching field values during the {@link FetchFieldsPhase}. Each {@link MappedFieldType}
* is in charge of defining a value fetcher through {@link MappedFieldType#valueFetcher}.
*/
public interface ValueFetcher {
/**
* This method is consumed by {@link #fetchDocumentField(String, Source, int)}.
*
* Given access to a document's _source, return this field's values.
*
* In addition to pulling out the values, they will be parsed into a standard form.
* For example numeric field mappers make sure to parse the source value into a number
* of the right type.
*
* Note that for array values, the order in which values are returned is undefined and
* should not be relied on.
*
* @param source the document's source.
* @param doc the document id
* @param ignoredValues a mutable list to collect any ignored values as they were originally presented in source
* @return a list a standardized field values.
*/
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy