Skip to content
Open
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
5 changes: 5 additions & 0 deletions django_elasticsearch_dsl/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
Byte,
Completion,
Date,
DenseVector,
Double,
Field,
Float,
Expand Down Expand Up @@ -201,6 +202,10 @@ class FloatField(DEDField, Float):
pass


class DenseVectorField(DEDField, DenseVector):
pass


class ScaledFloatField(DEDField, ScaledFloat):
pass

Expand Down
1 change: 1 addition & 0 deletions docs/source/fields.rst
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ Available Fields
- ``DoubleField(attr=None, **elasticsearch_properties)``
- ``FileField(attr=None, **elasticsearch_properties)``
- ``FloatField(attr=None, **elasticsearch_properties)``
- ``DenseVectorField(attr=None, **elasticsearch_properties)``
- ``IntegerField(attr=None, **elasticsearch_properties)``
- ``IpField(attr=None, **elasticsearch_properties)``
- ``KeywordField(attr=None, **elasticsearch_properties)``
Expand Down
11 changes: 10 additions & 1 deletion tests/test_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from django_elasticsearch_dsl.exceptions import VariableLookupError
from django_elasticsearch_dsl.fields import (BooleanField, ByteField, CompletionField, DEDField,
DateField, DoubleField, FileField, FloatField,
GeoPointField,
DenseVectorField, GeoPointField,
GeoShapeField, IntegerField, IpField, KeywordField,
ListField, LongField,
NestedField, ObjectField, ScaledFloatField, ShortField, TextField
Expand Down Expand Up @@ -349,6 +349,15 @@ def test_get_mapping(self):
}, field.to_dict())


class FloatFieldTestCase(TestCase):
def test_get_mapping(self):
field = DenseVectorField()

self.assertEqual({
'type': 'float',
}, field.to_dict())


class ScaledFloatFieldTestCase(TestCase):
def test_get_mapping(self):
field = ScaledFloatField(scaling_factor=100)
Expand Down