elasticsearch-haystack 2.1.0__py3-none-any.whl → 3.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of elasticsearch-haystack might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: elasticsearch-haystack
3
- Version: 2.1.0
3
+ Version: 3.0.0
4
4
  Summary: Haystack 2.x Document Store for ElasticSearch
5
5
  Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/elasticsearch#readme
6
6
  Project-URL: Issues, https://github.com/deepset-ai/haystack-core-integrations/issues
@@ -17,8 +17,9 @@ Classifier: Programming Language :: Python :: 3.11
17
17
  Classifier: Programming Language :: Python :: Implementation :: CPython
18
18
  Classifier: Programming Language :: Python :: Implementation :: PyPy
19
19
  Requires-Python: >=3.9
20
+ Requires-Dist: aiohttp
20
21
  Requires-Dist: elasticsearch<9,>=8
21
- Requires-Dist: haystack-ai
22
+ Requires-Dist: haystack-ai>=2.11.0
22
23
  Description-Content-Type: text/markdown
23
24
 
24
25
  [![test](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/elasticsearch.yml/badge.svg)](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/elasticsearch.yml)
@@ -2,9 +2,9 @@ haystack_integrations/components/retrievers/elasticsearch/__init__.py,sha256=cSJ
2
2
  haystack_integrations/components/retrievers/elasticsearch/bm25_retriever.py,sha256=ISHc6elYXoDXDvC62_3bMMCk_Dv67jvZIgQBCZ1ZHdw,7012
3
3
  haystack_integrations/components/retrievers/elasticsearch/embedding_retriever.py,sha256=jHDLMeecpf-DhvbRM1AAq2kIJn7xMNTR9vkm-FhHH7k,7332
4
4
  haystack_integrations/document_stores/elasticsearch/__init__.py,sha256=YTfu94dtVUBogbJFr1aJrKuaI6-Bw9VuHfPoyU7M8os,207
5
- haystack_integrations/document_stores/elasticsearch/document_store.py,sha256=xzMcKhWfVBZUxzzpchcsAf8qWjux-PfZ4zqa8kd4Hcg,28825
5
+ haystack_integrations/document_stores/elasticsearch/document_store.py,sha256=pZ0pPyOCPTCKNYD4q5YbLrslSGTIbVPj60U18-BImX8,27406
6
6
  haystack_integrations/document_stores/elasticsearch/filters.py,sha256=Umip-PP4uFjuWeB1JWkKhaKClQ0VpiykoDlDu99wIV0,9759
7
- elasticsearch_haystack-2.1.0.dist-info/METADATA,sha256=nemE4-8L0_hMZTDkLk6ubi2p4kT1ESaX_OLHD_8QQnQ,2118
8
- elasticsearch_haystack-2.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
- elasticsearch_haystack-2.1.0.dist-info/licenses/LICENSE,sha256=_M2kulivnaiTHiW-5CRlZrPmH47tt04pBgAgeDvfYi4,11342
10
- elasticsearch_haystack-2.1.0.dist-info/RECORD,,
7
+ elasticsearch_haystack-3.0.0.dist-info/METADATA,sha256=E0ClBwzkNrT0g2L39vhe1jpnFNOvYQzeR50jCcHfw5c,2149
8
+ elasticsearch_haystack-3.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
+ elasticsearch_haystack-3.0.0.dist-info/licenses/LICENSE,sha256=_M2kulivnaiTHiW-5CRlZrPmH47tt04pBgAgeDvfYi4,11342
10
+ elasticsearch_haystack-3.0.0.dist-info/RECORD,,
@@ -1,7 +1,6 @@
1
1
  # SPDX-FileCopyrightText: 2023-present deepset GmbH <info@deepset.ai>
2
2
  #
3
3
  # SPDX-License-Identifier: Apache-2.0
4
- import logging
5
4
  from collections.abc import Mapping
6
5
  from typing import Any, Dict, List, Literal, Optional, Union
7
6
 
@@ -9,7 +8,7 @@ import numpy as np
9
8
 
10
9
  # There are no import stubs for elastic_transport and elasticsearch so mypy fails
11
10
  from elastic_transport import NodeConfig # type: ignore[import-not-found]
12
- from haystack import default_from_dict, default_to_dict
11
+ from haystack import default_from_dict, default_to_dict, logging
13
12
  from haystack.dataclasses import Document
14
13
  from haystack.document_stores.errors import DocumentStoreError, DuplicateDocumentError
15
14
  from haystack.document_stores.types import DuplicatePolicy
@@ -36,7 +35,7 @@ DOC_ALREADY_EXISTS = 409
36
35
 
37
36
  class ElasticsearchDocumentStore:
38
37
  """
39
- ElasticsearchDocumentStore is a Document Store for Elasticsearch. It can be used with Elastic Cloud or your own
38
+ An ElasticsearchDocumentStore instance that works with Elastic Cloud or your own
40
39
  Elasticsearch cluster.
41
40
 
42
41
  Usage example (Elastic Cloud):
@@ -329,15 +328,6 @@ class ElasticsearchDocumentStore:
329
328
  data["metadata"]["highlighted"] = hit["highlight"]
330
329
  data["score"] = hit["_score"]
331
330
 
332
- if "dataframe" in data:
333
- dataframe = data.pop("dataframe")
334
- if dataframe:
335
- logger.warning(
336
- "Document %s has the `dataframe` field set,"
337
- "ElasticsearchDocumentStore no longer supports dataframes and this field will be ignored. "
338
- "The `dataframe` field will soon be removed from Haystack Document.",
339
- data["id"],
340
- )
341
331
  return Document.from_dict(data)
342
332
 
343
333
  def write_documents(self, documents: List[Document], policy: DuplicatePolicy = DuplicatePolicy.NONE) -> int:
@@ -365,23 +355,15 @@ class ElasticsearchDocumentStore:
365
355
  elasticsearch_actions = []
366
356
  for doc in documents:
367
357
  doc_dict = doc.to_dict()
368
- if "dataframe" in doc_dict:
369
- dataframe = doc_dict.pop("dataframe")
370
- if dataframe:
371
- logger.warning(
372
- "Document %s has the `dataframe` field set,"
373
- "ElasticsearchDocumentStore no longer supports dataframes and this field will be ignored. "
374
- "The `dataframe` field will soon be removed from Haystack Document.",
375
- doc.id,
376
- )
358
+
377
359
  if "sparse_embedding" in doc_dict:
378
360
  sparse_embedding = doc_dict.pop("sparse_embedding", None)
379
361
  if sparse_embedding:
380
362
  logger.warning(
381
- "Document %s has the `sparse_embedding` field set,"
363
+ "Document {doc_id} has the `sparse_embedding` field set,"
382
364
  "but storing sparse embeddings in Elasticsearch is not currently supported."
383
365
  "The `sparse_embedding` field will be ignored.",
384
- doc.id,
366
+ doc_id=doc.id,
385
367
  )
386
368
  elasticsearch_actions.append(
387
369
  {
@@ -449,23 +431,15 @@ class ElasticsearchDocumentStore:
449
431
  actions = []
450
432
  for doc in documents:
451
433
  doc_dict = doc.to_dict()
452
- if "dataframe" in doc_dict:
453
- dataframe = doc_dict.pop("dataframe")
454
- if dataframe:
455
- logger.warning(
456
- "Document {id} has the `dataframe` field set,"
457
- "ElasticsearchDocumentStore no longer supports dataframes and this field will be ignored. "
458
- "The `dataframe` field will soon be removed from Haystack Document.",
459
- )
460
434
 
461
435
  if "sparse_embedding" in doc_dict:
462
436
  sparse_embedding = doc_dict.pop("sparse_embedding", None)
463
437
  if sparse_embedding:
464
438
  logger.warning(
465
- "Document %s has the `sparse_embedding` field set,"
439
+ "Document {doc_id} has the `sparse_embedding` field set,"
466
440
  "but storing sparse embeddings in Elasticsearch is not currently supported."
467
441
  "The `sparse_embedding` field will be ignored.",
468
- doc.id,
442
+ doc_id=doc.id,
469
443
  )
470
444
 
471
445
  action = {