Created
September 6, 2016 14:04
-
-
Save lcpriest/369dda8649a16c392612f4d698b889b4 to your computer and use it in GitHub Desktop.
This file contains 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
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
Thanks! This was essentially what I was looking for, I've ended up using the keyword tokenizer (though I might just drop this, as it's essentially the same as not_analyzed) and a lowercase filter to allow for case insensitive search.
I ended up doing a static mapping for as many fields as I know in advance and will just look into again every month or so and see if I find any recurring fields in mappings that I didn't define yet.
Thanks for the post - I think the best piece of advice that someone gave was that the ES docs are not really reference docs, they are more like a tutorial. They are much better if you read them like a book and follow the pages; after that everything became a lot clearer.
Again, thank you, this has been really helpful.