Skip to content

Instantly share code, notes, and snippets.

@fvbock
Forked from lcpriest/elasticsearch.rb
Created March 7, 2017 01:44
Show Gist options
  • Save fvbock/c66b25f9574cbdd41618a9ac70ed8976 to your computer and use it in GitHub Desktop.
Save fvbock/c66b25f9574cbdd41618a9ac70ed8976 to your computer and use it in GitHub Desktop.
client = ElasticWrapper::Session.new.client
client.search(index: 'test', type: 'contacts', body: body)
body = { query: { bool: { filter: { term: { name: 'lachlan' } } } } }
=>
[{
"_index"=>"test",
"_type"=>"contact",
"_id"=>"1",
"_score"=>1.0,
"_source"=>{
"id"=>2157,
"name"=>"Lachlan Priest"
}
}]
body = { query: { bool: { filter: { term: { name: 'Lachlan' } } } } }
=>
[]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment