Engineering

Ruby and Python clients for Elastic Enterprise Search now generally available

Back in our 7.10 release of the Elastic Stack, we announced the beta of our Ruby and Python clients for Elastic Enterprise Search. Now, with 7.11, both the Ruby and Python clients are generally available. We’ve also begun work on a PHP client.

All client source code for both enterprise-search-ruby and enterprise-search-python is available on GitHub. Documentation on how to get started with each client is available on elastic.co.

Complete release notes for the 7.11.0 releases are available for Ruby and Python.

Ruby client for Elastic Enterprise Search

You can install the Ruby client for Elastic Enterprise Search from Rubygems:

$ gem install elastic-enterprise-search

After the installation is complete, you can read about how to configure client instances:

client = Elastic::EnterpriseSearch::Client.new(host: host) 
client.workplace_search.http_auth = access_token

You can index documents after adding a custom source and search for them after going through OAuth authentication:

client.workplace_search.search(body: {query: 'search query'}, access_token: access_token)

Python client for Elastic Enterprise Search

You can install the Python client for Elastic Enterprise Search with pip:

$ python -m pip install elastic-enterprise-search

Then, by following the getting started guide, you can create a new client instance for Elastic App Search:

from elastic_enterprise_search import AppSearch 
app_search = AppSearch(“https://3b898c...us-central1.gcp.cloud.es.io”) 
app_search.index_documents( 
    engine_name=”blog-posts”, 
    documents=[{ 
        “id”: “1”, 
        “title”: “Ruby and Python Enterprise Search clients now GA” 
    }] 
)

Coming soon: New PHP client for Elastic Enterprise Search

We are working on the PHP Elastic Enterprise Search client using PSR-7 as HTTP standard. We plan to release a beta version for Elastic Enterprise Search 7.12.

Next steps

If you’d like to try out the new clients, you can always start a free, 14-day trial of Elastic Enterprise Search on Elastic Cloud. Or, you can download and manage it yourself for free.