Last active
January 24, 2017 09:00
-
-
Save reggieb/d44cafe1e84dd1adceb6894405261147 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'elasticsearch' | |
# Set up client bypassing Elasticsearch's Faraday imported proxy settings (which ignore system's no_proxy) | |
# So transport_options needed to access local elasticsearch instance | |
client = Elasticsearch::Client.new log: true, transport_options: { proxy: '' } | |
# Retrieve data - setup instructions here: | |
# https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-elasticsearch-on-ubuntu-16-04 | |
client.get index: 'tutorial', type: 'helloworld', id: 1 | |
# Create a entry: | |
client.create index: 'foo', type: 'bar', id: 2, body: {message: 'Hello there!'} | |
# Search query: | |
client.search index: 'foo', type: 'bar', body: { query: { match: {message: 'hello'}}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment