ruby elasticsearch client
언어/Ruby2020. 5. 26. 20:34
require 'elasticsearch/transport'
require 'elasticsearch'
client = Elasticsearch::Client.new hosts: [
{ host: '',
port: 9200,
user: "",
password: ""
}
]
#client.index index: 'myindex', type: 'mytype', id: 1, body: { title: 'Test' }
response = client.search index: 'myindex', body: { query: { match: { title: 'test' } } }
puts response["hits"]["hits"][0]["_source"]
require | import |
'언어 > Ruby' 카테고리의 다른 글
ruby json 파일 읽기 (0) | 2020.07.02 |
---|---|
ruby + elasticsearch indices/ health (0) | 2020.07.02 |
cea(ver3) (0) | 2016.02.27 |
class (0) | 2016.02.27 |
루비(ruby)상속 -> 상속 -> 상속 (0) | 2016.02.26 |