Retrieve from Elasticsearch indices in PyTerrier.
Powered by the elasticsearch
package.
pip install pyterrier_elasticsearch
from elasticsearch import Elasticsearch
from pyterrier_elasticsearch import ElasticsearchRetrieve
client = Elasticsearch(...)
es = ElasticsearchRetrieve(
client=client,
index="test-index",
fields=["text", "title"],
columns={
# source field -> destination column
"text": "text",
"title": "title",
},
)
# Use PyTerrier functions like with BatchRetrieve.
es.search("python library")
Also, check out the sample notebook or open it in Google Colab .
To build and develop this package you need to install the build
package:
pip install build
Install package dependencies:
pip install -e .
Install test dependencies:
pip install -e .[test]
Verify your changes against the test suite to verify.
flake8 pyterrier_elasticsearch examples tests
pylint -E pyterrier_elasticsearch examples tests
pytest pyterrier_elasticsearch examples tests
Please also add tests for the axioms or integrations you've added.
A wheel for this package can be built by:
python -m build
This repository is released under the MIT license.