/* SPDX-License-Identifier: Apache-2.0 * * The OpenSearch Contributors require contributions made to * this file be licensed under the Apache-2.0 license or a * compatible open source license. */ /* * Modifications Copyright OpenSearch Contributors. See * GitHub history for details. * * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch B.V. licenses this file to you under * the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ using System; using System.Collections.Generic; using System.Linq.Expressions; namespace OpenSearch.Client { public class SingleMappingSelector : SelectorBase, IPropertiesDescriptor where T : class { /// public IProperty Binary(Func, IBinaryProperty> selector) => selector?.Invoke(new BinaryPropertyDescriptor()); /// public IProperty Boolean(Func, IBooleanProperty> selector) => selector?.Invoke(new BooleanPropertyDescriptor()); /// public IProperty Completion(Func, ICompletionProperty> selector) => selector?.Invoke(new CompletionPropertyDescriptor()); /// public IProperty Date(Func, IDateProperty> selector) => selector?.Invoke(new DatePropertyDescriptor()); /// public IProperty DateNanos(Func, IDateNanosProperty> selector) => selector?.Invoke(new DateNanosPropertyDescriptor()); /// public IProperty DateRange(Func, IDateRangeProperty> selector) => selector?.Invoke(new DateRangePropertyDescriptor()); /// public IProperty DoubleRange(Func, IDoubleRangeProperty> selector) => selector?.Invoke(new DoubleRangePropertyDescriptor()); /// public IProperty FloatRange(Func, IFloatRangeProperty> selector) => selector?.Invoke(new FloatRangePropertyDescriptor()); /// public IProperty GeoPoint(Func, IGeoPointProperty> selector) => selector?.Invoke(new GeoPointPropertyDescriptor()); /// public IProperty GeoShape(Func, IGeoShapeProperty> selector) => selector?.Invoke(new GeoShapePropertyDescriptor()); /// public IProperty IntegerRange(Func, IIntegerRangeProperty> selector) => selector?.Invoke(new IntegerRangePropertyDescriptor()); /// public IProperty Ip(Func, IIpProperty> selector) => selector?.Invoke(new IpPropertyDescriptor()); /// public IProperty IpRange(Func, IIpRangeProperty> selector) => selector?.Invoke(new IpRangePropertyDescriptor()); /// public IProperty Join(Func, IJoinProperty> selector) => selector?.Invoke(new JoinPropertyDescriptor()); /// public IProperty FieldAlias(Func, IFieldAliasProperty> selector) => selector?.Invoke(new FieldAliasPropertyDescriptor()); /// public IProperty RankFeature(Func, IRankFeatureProperty> selector) => selector?.Invoke(new RankFeaturePropertyDescriptor()); /// public IProperty RankFeatures(Func, IRankFeaturesProperty> selector) => selector?.Invoke(new RankFeaturesPropertyDescriptor()); /// public IProperty Keyword(Func, IKeywordProperty> selector) => selector?.Invoke(new KeywordPropertyDescriptor()); /// public IProperty LongRange(Func, ILongRangeProperty> selector) => selector?.Invoke(new LongRangePropertyDescriptor()); /// public IProperty Murmur3Hash(Func, IMurmur3HashProperty> selector) => selector?.Invoke(new Murmur3HashPropertyDescriptor()); /// public IProperty Nested(Func, INestedProperty> selector) where TChild : class => selector?.Invoke(new NestedPropertyDescriptor()); /// /// Number introduces a numeric mapping that defaults to `float` use .Type() to set the right type if needed or use /// Scalar instead of /// public IProperty Number(Func, INumberProperty> selector) => selector?.Invoke(new NumberPropertyDescriptor()); /// public IProperty Object(Func, IObjectProperty> selector) where TChild : class => selector?.Invoke(new ObjectTypeDescriptor()); /// public IProperty Percolator(Func, IPercolatorProperty> selector) => selector?.Invoke(new PercolatorPropertyDescriptor()); /// public IProperty Text(Func, ITextProperty> selector) => selector?.Invoke(new TextPropertyDescriptor()); /// public IProperty TokenCount(Func, ITokenCountProperty> selector) => selector?.Invoke(new TokenCountPropertyDescriptor()); /// public IProperty Generic(Func, IGenericProperty> selector) => selector?.Invoke(new GenericPropertyDescriptor()); /// public IProperty SearchAsYouType(Func, ISearchAsYouTypeProperty> selector) => selector?.Invoke(new SearchAsYouTypePropertyDescriptor()); /// public IProperty KnnVector(Func, IKnnVectorProperty> selector) => selector?.Invoke(new KnnVectorPropertyDescriptor()); #pragma warning disable CS3001 // Argument type is not CLS-compliant public IProperty Scalar(Expression> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Float)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Byte)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Short)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector = null ) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector = null ) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Long)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector = null ) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector = null ) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression>> field, Func, INumberProperty> selector = null ) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Double)); public IProperty Scalar(Expression> field, Func, INumberProperty> selector = null) => selector.InvokeOrDefault(new NumberPropertyDescriptor().Name(field).Type(NumberType.Integer)); public IProperty Scalar(Expression> field, Func, IDateProperty> selector = null) => selector.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IDateProperty> selector = null) => selector.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); public IProperty Scalar(Expression>> field, Func, IDateProperty> selector = null) => selector.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); public IProperty Scalar(Expression>> field, Func, IDateProperty> selector = null) => selector.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IDateProperty> selector = null) => selector.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IDateProperty> selector = null) => selector.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); public IProperty Scalar(Expression>> field, Func, IDateProperty> selector = null ) => selector.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); public IProperty Scalar(Expression>> field, Func, IDateProperty> selector = null ) => selector.InvokeOrDefault(new DatePropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IBooleanProperty> selector = null) => selector.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IBooleanProperty> selector = null) => selector.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field)); public IProperty Scalar(Expression>> field, Func, IBooleanProperty> selector = null) => selector.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field)); public IProperty Scalar(Expression>> field, Func, IBooleanProperty> selector = null ) => selector.InvokeOrDefault(new BooleanPropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IKeywordProperty> selector = null) => selector.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IKeywordProperty> selector = null) => selector.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); public IProperty Scalar(Expression>> field, Func, IKeywordProperty> selector = null) => selector.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); public IProperty Scalar(Expression>> field, Func, IKeywordProperty> selector = null ) => selector.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IKeywordProperty> selector = null) => selector.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IKeywordProperty> selector = null) => selector.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); public IProperty Scalar(Expression>> field, Func, IKeywordProperty> selector = null) => selector.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); public IProperty Scalar(Expression>> field, Func, IKeywordProperty> selector = null ) => selector.InvokeOrDefault(new KeywordPropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, ITextProperty> selector = null) => selector.InvokeOrDefault(new TextPropertyDescriptor().Name(field)); public IProperty Scalar(Expression>> field, Func, ITextProperty> selector = null) => selector.InvokeOrDefault(new TextPropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IDateRangeProperty> selector = null) => selector.InvokeOrDefault(new DateRangePropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IDoubleRangeProperty> selector = null ) => selector.InvokeOrDefault(new DoubleRangePropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, ILongRangeProperty> selector = null) => selector.InvokeOrDefault(new LongRangePropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IIntegerRangeProperty> selector = null ) => selector.InvokeOrDefault(new IntegerRangePropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IFloatRangeProperty> selector = null) => selector.InvokeOrDefault(new FloatRangePropertyDescriptor().Name(field)); public IProperty Scalar(Expression> field, Func, IIpRangeProperty> selector = null) => selector.InvokeOrDefault(new IpRangePropertyDescriptor().Name(field)); #pragma warning restore CS3001 // Argument type is not CLS-compliant } }