Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions elasticsearch/dsl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,30 @@
TermsFacet,
)
from .field import (
AggregateMetricDouble,
Alias,
Binary,
Boolean,
Byte,
Completion,
ConstantKeyword,
CountedKeyword,
CustomField,
Date,
DateNanos,
DateRange,
DenseVector,
Double,
DoubleRange,
Field,
Flattened,
Float,
FloatRange,
GeoPoint,
GeoShape,
HalfFloat,
Histogram,
IcuCollationKeyword,
Integer,
IntegerRange,
Ip,
Expand All @@ -63,21 +70,28 @@
Keyword,
Long,
LongRange,
MatchOnlyText,
Murmur3,
Nested,
Object,
Passthrough,
Percolator,
Point,
RangeField,
RankFeature,
RankFeatures,
RankVectors,
ScaledFloat,
SearchAsYouType,
SemanticText,
Shape,
Short,
SparseVector,
Text,
TokenCount,
UnsignedLong,
Version,
Wildcard,
construct_field,
)
from .function import SF
Expand Down Expand Up @@ -108,6 +122,8 @@
"A",
"Agg",
"AggResponse",
"AggregateMetricDouble",
"Alias",
"AsyncComposableIndexTemplate",
"AsyncDocument",
"AsyncEmptySearch",
Expand All @@ -126,9 +142,11 @@
"Completion",
"ComposableIndexTemplate",
"ConstantKeyword",
"CountedKeyword",
"CustomField",
"Date",
"DateHistogramFacet",
"DateNanos",
"DateRange",
"DenseVector",
"Document",
Expand All @@ -142,12 +160,15 @@
"FacetedResponse",
"FacetedSearch",
"Field",
"Flattened",
"Float",
"FloatRange",
"GeoPoint",
"GeoShape",
"HalfFloat",
"Histogram",
"HistogramFacet",
"IcuCollationKeyword",
"IllegalOperation",
"Index",
"IndexTemplate",
Expand All @@ -162,12 +183,14 @@
"LongRange",
"M",
"Mapping",
"MatchOnlyText",
"MetaField",
"MultiSearch",
"Murmur3",
"Nested",
"NestedFacet",
"Object",
"Passthrough",
"Percolator",
"Point",
"Q",
Expand All @@ -177,21 +200,26 @@
"RangeField",
"RankFeature",
"RankFeatures",
"RankVectors",
"Response",
"SF",
"ScaledFloat",
"Search",
"SearchAsYouType",
"SemanticText",
"Shape",
"Short",
"SparseVector",
"TermsFacet",
"Text",
"TokenCount",
"UnknownDslObject",
"UnsignedLong",
"UpdateByQuery",
"UpdateByQueryResponse",
"ValidationException",
"Version",
"Wildcard",
"analyzer",
"async_connections",
"char_filter",
Expand Down
17 changes: 17 additions & 0 deletions test_elasticsearch/test_dsl/test_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import pytest
from dateutil import tz

from elasticsearch import dsl
from elasticsearch.dsl import InnerDoc, Range, ValidationException, field


Expand Down Expand Up @@ -232,3 +233,19 @@ class Inner(InnerDoc):

with pytest.raises(ValidationException):
field.Object(doc_class=Inner, dynamic=False)


def test_all_fields_exported() -> None:
"""Make sure that all the generated field classes are exported at the top-level"""
fields = [
f
for f in dir(field)
if isinstance(getattr(field, f), type)
and issubclass(getattr(field, f), field.Field)
]
all = dir(dsl)
not_found = []
for f in fields:
if f not in all:
not_found.append(f)
assert not_found == []