Skip to content

Commit 2983d50

Browse files
upgrade transport required versions
1 parent 6546116 commit 2983d50

File tree

4 files changed

+72
-4
lines changed

4 files changed

+72
-4
lines changed

elasticsearch/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
# Ensure that a compatible version of elastic-transport is installed.
3030
_version_groups = tuple(int(x) for x in re.search(r"^(\d+)\.(\d+)\.(\d+)", _elastic_transport_version).groups()) # type: ignore[union-attr]
31-
if _version_groups < (8, 0, 0) or _version_groups > (9, 0, 0):
31+
if _version_groups < (9, 1, 0) or _version_groups > (10, 0, 0):
3232
raise ImportError(
3333
"An incompatible version of elastic-transport is installed. Must be between "
3434
"v8.0.0 and v9.0.0. Install the correct version with the following command: "

elasticsearch/dsl/field.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4081,6 +4081,9 @@ def __init__(
40814081
class SparseVector(Field):
40824082
"""
40834083
:arg store:
4084+
:arg index_options: Additional index options for the sparse vector
4085+
field that controls the token pruning behavior of the sparse
4086+
vector field.
40844087
:arg meta: Metadata about the field.
40854088
:arg properties:
40864089
:arg ignore_above:
@@ -4099,6 +4102,9 @@ def __init__(
40994102
self,
41004103
*args: Any,
41014104
store: Union[bool, "DefaultType"] = DEFAULT,
4105+
index_options: Union[
4106+
"types.SparseVectorIndexOptions", Dict[str, Any], "DefaultType"
4107+
] = DEFAULT,
41024108
meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
41034109
properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
41044110
ignore_above: Union[int, "DefaultType"] = DEFAULT,
@@ -4113,6 +4119,8 @@ def __init__(
41134119
):
41144120
if store is not DEFAULT:
41154121
kwargs["store"] = store
4122+
if index_options is not DEFAULT:
4123+
kwargs["index_options"] = index_options
41164124
if meta is not DEFAULT:
41174125
kwargs["meta"] = meta
41184126
if properties is not DEFAULT:

elasticsearch/dsl/types.py

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,26 @@ def __init__(
144144

145145
class ChunkingSettings(AttrDict[Any]):
146146
"""
147-
:arg strategy: (required) The chunking strategy: `sentence` or `word`.
148-
Defaults to `sentence` if omitted.
147+
:arg strategy: (required) The chunking strategy: `sentence`, `word`,
148+
`none` or `recursive`. * If `strategy` is set to `recursive`,
149+
you must also specify: - `max_chunk_size` - either `separators`
150+
or`separator_group` Learn more about different chunking
151+
strategies in the linked documentation. Defaults to `sentence` if
152+
omitted.
153+
:arg separator_group: (required) This parameter is only applicable
154+
when using the `recursive` chunking strategy. Sets a predefined
155+
list of separators in the saved chunking settings based on the
156+
selected text type. Values can be `markdown` or `plaintext`.
157+
Using this parameter is an alternative to manually specifying a
158+
custom `separators` list.
159+
:arg separators: (required) A list of strings used as possible split
160+
points when chunking text with the `recursive` strategy. Each
161+
string can be a plain string or a regular expression (regex)
162+
pattern. The system tries each separator in order to split the
163+
text, starting from the first item in the list. After splitting,
164+
it attempts to recombine smaller pieces into larger chunks that
165+
stay within the `max_chunk_size` limit, to reduce the total number
166+
of chunks generated.
149167
:arg max_chunk_size: (required) The maximum size of a chunk in words.
150168
This value cannot be higher than `300` or lower than `20` (for
151169
`sentence` strategy) or `10` (for `word` strategy). Defaults to
@@ -160,6 +178,8 @@ class ChunkingSettings(AttrDict[Any]):
160178
"""
161179

162180
strategy: Union[str, DefaultType]
181+
separator_group: Union[str, DefaultType]
182+
separators: Union[Sequence[str], DefaultType]
163183
max_chunk_size: Union[int, DefaultType]
164184
overlap: Union[int, DefaultType]
165185
sentence_overlap: Union[int, DefaultType]
@@ -168,13 +188,19 @@ def __init__(
168188
self,
169189
*,
170190
strategy: Union[str, DefaultType] = DEFAULT,
191+
separator_group: Union[str, DefaultType] = DEFAULT,
192+
separators: Union[Sequence[str], DefaultType] = DEFAULT,
171193
max_chunk_size: Union[int, DefaultType] = DEFAULT,
172194
overlap: Union[int, DefaultType] = DEFAULT,
173195
sentence_overlap: Union[int, DefaultType] = DEFAULT,
174196
**kwargs: Any,
175197
):
176198
if strategy is not DEFAULT:
177199
kwargs["strategy"] = strategy
200+
if separator_group is not DEFAULT:
201+
kwargs["separator_group"] = separator_group
202+
if separators is not DEFAULT:
203+
kwargs["separators"] = separators
178204
if max_chunk_size is not DEFAULT:
179205
kwargs["max_chunk_size"] = max_chunk_size
180206
if overlap is not DEFAULT:
@@ -3723,6 +3749,38 @@ def __init__(
37233749
super().__init__(kwargs)
37243750

37253751

3752+
class SparseVectorIndexOptions(AttrDict[Any]):
3753+
"""
3754+
:arg prune: Whether to perform pruning, omitting the non-significant
3755+
tokens from the query to improve query performance. If prune is
3756+
true but the pruning_config is not specified, pruning will occur
3757+
but default values will be used. Default: false
3758+
:arg pruning_config: Optional pruning configuration. If enabled, this
3759+
will omit non-significant tokens from the query in order to
3760+
improve query performance. This is only used if prune is set to
3761+
true. If prune is set to true but pruning_config is not specified,
3762+
default values will be used.
3763+
"""
3764+
3765+
prune: Union[bool, DefaultType]
3766+
pruning_config: Union["TokenPruningConfig", Dict[str, Any], DefaultType]
3767+
3768+
def __init__(
3769+
self,
3770+
*,
3771+
prune: Union[bool, DefaultType] = DEFAULT,
3772+
pruning_config: Union[
3773+
"TokenPruningConfig", Dict[str, Any], DefaultType
3774+
] = DEFAULT,
3775+
**kwargs: Any,
3776+
):
3777+
if prune is not DEFAULT:
3778+
kwargs["prune"] = prune
3779+
if pruning_config is not DEFAULT:
3780+
kwargs["pruning_config"] = pruning_config
3781+
super().__init__(kwargs)
3782+
3783+
37263784
class SuggestContext(AttrDict[Any]):
37273785
"""
37283786
:arg name: (required)
@@ -5166,9 +5224,11 @@ def buckets_as_dict(self) -> Mapping[str, "FiltersBucket"]:
51665224
class FiltersBucket(AttrDict[Any]):
51675225
"""
51685226
:arg doc_count: (required)
5227+
:arg key:
51695228
"""
51705229

51715230
doc_count: int
5231+
key: str
51725232

51735233

51745234
class FrequentItemSetsAggregate(AttrDict[Any]):

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ keywords = [
4242
]
4343
dynamic = ["version"]
4444
dependencies = [
45-
"elastic-transport>=8.15.1,<9",
45+
"elastic-transport>=9.1.0,<10",
4646
"python-dateutil",
4747
"typing-extensions",
4848
]

0 commit comments

Comments
 (0)