Add builder for distance_feature to QueryBuilders (#47846)
The QueryBuilders convenience class is currently missing a shortcut to construct a DistanceFeatureQueryBuilder, which is added here. Closes #47767
This commit is contained in:
parent
5cbc96ccb6
commit
2ef12c37f5
|
@ -25,6 +25,7 @@ import org.elasticsearch.common.geo.GeoPoint;
|
|||
import org.elasticsearch.common.geo.ShapeRelation;
|
||||
import org.elasticsearch.common.geo.builders.ShapeBuilder;
|
||||
import org.elasticsearch.geometry.Geometry;
|
||||
import org.elasticsearch.index.query.DistanceFeatureQueryBuilder.Origin;
|
||||
import org.elasticsearch.index.query.MoreLikeThisQueryBuilder.Item;
|
||||
import org.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder;
|
||||
import org.elasticsearch.index.query.functionscore.ScoreFunctionBuilder;
|
||||
|
@ -113,6 +114,16 @@ public final class QueryBuilders {
|
|||
return new DisMaxQueryBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* A query to boost scores based on their proximity to the given origin for date, date_nanos and geo_point field types.
|
||||
* @param name The field name
|
||||
* @param origin The origin of the distance calculation. Can be a long, string or {@link GeoPoint}, depending on field type.
|
||||
* @param pivot The distance from the origin at which relevance scores receive half of the boost value.
|
||||
*/
|
||||
public static DistanceFeatureQueryBuilder distanceFeatureQuery(String name, Origin origin, String pivot) {
|
||||
return new DistanceFeatureQueryBuilder(name, origin, pivot);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a query that will match only specific ids within all types.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue