This is an add-on to official Python Elasticsearch client adding support for Elasticsearch Learning to Rank plugin API.
python -m pip install elasticsearch_ltr
from elasticsearch import Elasticsearch
from elasticsearch_ltr import LTRClient
client = Elasticsearch()
LTRClient.infect_client(client)
client.ltr.create_feature_store()
...
For more code you may check out tests/
folder.
You'll have to run Elasticsearch on localhost:9200
with LTR plugin installed. Then just do
python -m pytest tests/