It should have been easy to find but somehow we didn't find out
How to connect tire* to an external server?
*Tire is A rich Ruby API and DSL for the ElasticSearch search engine
if you mean different than localhost:9200, it should be something like this
require 'tire'
Tire.configure { url "http://ec2-232-10-73-111.compute-1.amazonaws.com:9200" }
Related
I wondered if it's possible to use /GeoLite2-City.mmdb or /GeoLite2-country.mmdb included in Elasticsearch as API. I mean, I would query it to give me IP details Instead of using an API from a different service?
how to connect Amazon Athena with Ruby and execute query over Amazon Athena and get result.
we not able to find any gem or example with help us to connect Amazon Athena in ruby.
Please provide any reference using which we can use to build connection with Amazon Athena and build a custom query executor in Ruby.
just to clarify my application on production so changing SDK from Ruby to JRuby is not a suitable option for me.
Per May 19th 2017, Amazon Athena supports query execution via SDK and CLI.
Ruby API client for Athena documentation # docs.aws.amazon.com
Source code of aws-sdk-athena # github.com/aws/aws-sdk-ruby
I found that the official Amazon SDK for athena was a bit complicated, so I made a new gem called Athens that wraps the SDK in a nicer interface:
conn = Athens::Connection.new(database: 'sample')
query = conn.execute("SELECT * FROM mytable")
If using JRuby is not acceptable, there is another option that could work - but be warned that it's not 100% Ruby!
You could set up a Java Lambda function that encapsulates the query logic, taking in search parameters and then connecting directly to Athena using the JDBC driver.
Then call the Lambda function from Ruby - either via HTTP or through the Ruby client.
Using Lambda function is good alternative but if some one not like to pay additional service amount then batter to implment small application with jetty using rest service in JAVA with sql query as parameter and response text as output(your prefer format) will give you workaround to move on.
JRuby is required. Athena offers only JDBC driver. It works only in JRE.
I am using logstash+elasticsearch to index server logs. The Elasticsearch server is running at localhost:9200 with millions of server log docs.
I also have a Rails app running at localhost:3000. I need to connect this rails app to the ES server.
I have read about the "elasticsearch-rails" gem but everywhere i found them using ActiveRecords/ Models. However, i don't think ActiveRecords are required for this. I just need a way to query the ES server index and fetch the documents inside my Rails app.
Is there a way to do this? Can anyone please help me with this situation? please comment if I am not clear with my question.
Thanks in advance.
There are many solutions out there, but one that stands out is (e.g.) Stretcher which provides a very simple API that closely matches the Elasticsearch API.
For instance:
server = Stretcher::Server.new('http://localhost:9200')
res = server.index(:myindex).search(size: 10, query: {match_all: {}})
# res is of type Stretcher::SearchResults
res.total # => 10
res.documents # => [#<Hashie::Mash _id="4" text="Hello 4">, ...]
...
Hi am new in elastic search, I installed the elastic search in my windows 7 machine but I can't know, how to run and use elastic search queries in windows where should I type the elastic search queries and where should I run this queries?..
Any one know about it help me. Thanks in advance...
There are multiple ways to do that.
via HTTP interface, which means that you can run GET queries via your browser (Firefox, Chrome etc.) by accesing the proper url like:
http://localhost:9200/_search?q=tag:wow
Elasticsearch's HEAD plugin. You can execute any query with it. It also has multiple additional functionalities.
Install cUrl for Windows and then run queries just like every tutorial suggests.
use any programming language like PHP that supports curl library.
Personally I prefer HEAD plugin since it has other functionalities that I use anyway.
you can also check sense plugin for chrome. It will also help you in syntax for queries.
you can get it from here
https://github.com/bleskes/sense
Is there a gem other than:
https://github.com/wellbredgrapefruit/asari
https://github.com/spokesoftware/aws_cloud_search
for using aws cloud search in ruby? I'm trying to evaluate which one to use and want to make sure I'm not missing the_gem_one_that_everyone_uses.
There's also Cloudsearchable: https://github.com/awslabs/cloudsearchable
It provides AR-like query building syntax and a simple API for mapping ActiveModel-like objects to a Cloudsearch index.