Skip to content

Commit 989c8fd

Browse files
Move numpy dense vector to a subclass
1 parent f30a399 commit 989c8fd

File tree

2 files changed

+0
-16
lines changed

2 files changed

+0
-16
lines changed

elasticsearch/dsl/field.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,8 +1555,6 @@ class DenseVector(Field):
15551555
:arg dynamic:
15561556
:arg fields:
15571557
:arg synthetic_source_keep:
1558-
:arg use_numpy: if set to ``True``, deserialize as a numpy array.
1559-
:arg dtype: The numpy data type to use as a string, when ``use_numpy`` is ``True``. The default is "float32".
15601558
"""
15611559

15621560
name = "dense_vector"
@@ -1589,8 +1587,6 @@ def __init__(
15891587
synthetic_source_keep: Union[
15901588
Literal["none", "arrays", "all"], "DefaultType"
15911589
] = DEFAULT,
1592-
use_numpy: bool = False,
1593-
dtype: str = "float32",
15941590
**kwargs: Any,
15951591
):
15961592
if dims is not DEFAULT:
@@ -1618,8 +1614,6 @@ def __init__(
16181614
self._element_type = kwargs.get("element_type", "float")
16191615
if self._element_type in ["float", "byte"]:
16201616
kwargs["multi"] = True
1621-
self._use_numpy = use_numpy
1622-
self._dtype = dtype
16231617
super().__init__(*args, **kwargs)
16241618

16251619

utils/templates/field.py.tpl

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,6 @@ class {{ k.name }}({{ k.parent }}):
217217
{% endfor %}
218218
{% endfor %}
219219
{% endif %}
220-
{% if k.field == "dense_vector" %}
221-
:arg use_numpy: if set to ``True``, deserialize as a numpy array.
222-
:arg dtype: The numpy data type to use as a string, when ``use_numpy`` is ``True``. The default is "float32".
223-
{% endif %}
224220
"""
225221
name = "{{ k.field }}"
226222
{% if k.coerced %}
@@ -250,10 +246,6 @@ class {{ k.name }}({{ k.parent }}):
250246
{{ arg.name }}: {{ arg.type }} = DEFAULT,
251247
{% endif %}
252248
{% endfor %}
253-
{% if k.field == "dense_vector" %}
254-
use_numpy: bool = False,
255-
dtype: str = "float32",
256-
{% endif %}
257249
**kwargs: Any
258250
):
259251
{% for arg in k.args %}
@@ -424,8 +416,6 @@ class {{ k.name }}({{ k.parent }}):
424416
self._element_type = kwargs.get("element_type", "float")
425417
if self._element_type in ["float", "byte"]:
426418
kwargs["multi"] = True
427-
self._use_numpy = use_numpy
428-
self._dtype = dtype
429419
super().__init__(*args, **kwargs)
430420

431421
class NumpyDenseVector(DenseVector):

0 commit comments

Comments
 (0)