Skip to content
Ruby client for the Swiftype Enterprise API
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
spec
.gitignore
.travis.yml
Gemfile
LICENSE
LICENSE.txt
README.md
Rakefile
logo-enterprise-search.png
swiftype-enterprise.gemspec

README.md

Elastic Enterprise Search Logo

GitHub release

A first-party Ruby client for Elastic Enterprise Search.

Contents


Getting started 🐣

To install the gem, execute:

gem install swiftype-enterprise

Or place gem 'swiftype-enterprise', '~> 1.0.0 in your Gemfile and run bundle install.

Usage

Create a new instance of the Swiftype Enterprise Client with your access token:

SwiftypeEnterprise.access_token = '' # your access token
swiftype = SwiftypeEnterprise::Client.new

Indexing Documents

This example shows how to use the index_documents method:

content_source_key = '' # your content source key
documents = [
  {
    'external_id' => 'INscMGmhmX4',
    'url' => 'http://www.youtube.com/watch?v=v1uyQZNg2vE',
    'title' => 'The Original Grumpy Cat',
    'body' => 'this is a test'
  },
  {
    'external_id' => 'JNDFojsd02',
    'url' => 'http://www.youtube.com/watch?v=tsdfhk2j',
    'title' => 'Another Grumpy Cat',
    'body' => 'this is also a test'
  }
]

begin
  document_receipts = swiftype.index_documents(content_source_key, documents)
  # handle results
rescue SwiftypeEnterprise::ClientException => e
  # handle error
end

Destroying Documents

content_source_key = '' # your content source key
document_external_ids = ['INscMGmhmX4', 'JNDFojsd02']

begin
  destroy_document_results = swiftype.destroy_documents(content_source_key, document_external_ids)
  # handle destroy document results
rescue SwiftypeEnterprise::ClientException => e
  # handle error
end

Running tests

Run tests via rspec:

$ ENDPOINT=http://localhost:3002/api/v1 bundle exec rspec

FAQ 🔮

Where do I report issues with the client?

If something is not working as expected, please open an issue.

Contribute 🚀

We welcome contributors to the project. Before you begin, a couple notes...

License 📗

MIT © Elastic

Thank you to all the contributors!

You can’t perform that action at this time.