|
19 | 19 |
|
20 | 20 | from elastic_transport.client_utils import DEFAULT, DefaultType |
21 | 21 |
|
22 | | -from elasticsearch_dsl import Query, function |
| 22 | +from elasticsearch_dsl import Query |
23 | 23 | from elasticsearch_dsl.document_base import InstrumentedField |
24 | 24 | from elasticsearch_dsl.utils import AttrDict |
25 | 25 |
|
@@ -688,74 +688,6 @@ def __init__( |
688 | 688 | super().__init__(kwargs) |
689 | 689 |
|
690 | 690 |
|
691 | | -class FunctionScoreContainer(AttrDict[Any]): |
692 | | - """ |
693 | | - :arg exp: Function that scores a document with a exponential decay, |
694 | | - depending on the distance of a numeric field value of the document |
695 | | - from an origin. |
696 | | - :arg gauss: Function that scores a document with a normal decay, |
697 | | - depending on the distance of a numeric field value of the document |
698 | | - from an origin. |
699 | | - :arg linear: Function that scores a document with a linear decay, |
700 | | - depending on the distance of a numeric field value of the document |
701 | | - from an origin. |
702 | | - :arg field_value_factor: Function allows you to use a field from a |
703 | | - document to influence the score. It’s similar to using the |
704 | | - script_score function, however, it avoids the overhead of |
705 | | - scripting. |
706 | | - :arg random_score: Generates scores that are uniformly distributed |
707 | | - from 0 up to but not including 1. In case you want scores to be |
708 | | - reproducible, it is possible to provide a `seed` and `field`. |
709 | | - :arg script_score: Enables you to wrap another query and customize the |
710 | | - scoring of it optionally with a computation derived from other |
711 | | - numeric field values in the doc using a script expression. |
712 | | - :arg filter: |
713 | | - :arg weight: |
714 | | - """ |
715 | | - |
716 | | - exp: Union[function.DecayFunction, DefaultType] |
717 | | - gauss: Union[function.DecayFunction, DefaultType] |
718 | | - linear: Union[function.DecayFunction, DefaultType] |
719 | | - field_value_factor: Union[function.FieldValueFactorScore, DefaultType] |
720 | | - random_score: Union[function.RandomScore, DefaultType] |
721 | | - script_score: Union[function.ScriptScore, DefaultType] |
722 | | - filter: Union[Query, DefaultType] |
723 | | - weight: Union[float, DefaultType] |
724 | | - |
725 | | - def __init__( |
726 | | - self, |
727 | | - *, |
728 | | - exp: Union[function.DecayFunction, DefaultType] = DEFAULT, |
729 | | - gauss: Union[function.DecayFunction, DefaultType] = DEFAULT, |
730 | | - linear: Union[function.DecayFunction, DefaultType] = DEFAULT, |
731 | | - field_value_factor: Union[ |
732 | | - function.FieldValueFactorScore, DefaultType |
733 | | - ] = DEFAULT, |
734 | | - random_score: Union[function.RandomScore, DefaultType] = DEFAULT, |
735 | | - script_score: Union[function.ScriptScore, DefaultType] = DEFAULT, |
736 | | - filter: Union[Query, DefaultType] = DEFAULT, |
737 | | - weight: Union[float, DefaultType] = DEFAULT, |
738 | | - **kwargs: Any, |
739 | | - ): |
740 | | - if exp is not DEFAULT: |
741 | | - kwargs["exp"] = exp |
742 | | - if gauss is not DEFAULT: |
743 | | - kwargs["gauss"] = gauss |
744 | | - if linear is not DEFAULT: |
745 | | - kwargs["linear"] = linear |
746 | | - if field_value_factor is not DEFAULT: |
747 | | - kwargs["field_value_factor"] = field_value_factor |
748 | | - if random_score is not DEFAULT: |
749 | | - kwargs["random_score"] = random_score |
750 | | - if script_score is not DEFAULT: |
751 | | - kwargs["script_score"] = script_score |
752 | | - if filter is not DEFAULT: |
753 | | - kwargs["filter"] = filter |
754 | | - if weight is not DEFAULT: |
755 | | - kwargs["weight"] = weight |
756 | | - super().__init__(kwargs) |
757 | | - |
758 | | - |
759 | 691 | class FuzzyQuery(AttrDict[Any]): |
760 | 692 | """ |
761 | 693 | :arg value: (required) Term you wish to find in the provided field. |
|
0 commit comments