Way to search exact string?
See original GitHub issueHi,
In kibana, we can search exact string by wrapping it by double quotation marks.
It seems
s = s.query('match', content="Donald Trump")
is searching for Donald or Trump.
Using dsl-py how can we search exact string?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Tip #5: Search for an Exact Phrase - InformIT
When you're searching for an exact phrase, you won't get the best results simply by entering all the words in the phrase as...
Read more >Searching for *exact* string on Google or other search engines
Try your search with the SymbolHound search engine.
Read more >Google Tips and Tricks: Limit Search - Exact Phrase - LibGuides
Insert quotation marks to search for a specific phrase or word. This can help you find quotes, search for song lyrics, or identify...
Read more >How do I make Google search for a nice short EXACT phrase
So how do I search for the EXACT phrase "pick-up truss" ? Even searching for. "pick-up truss" -pickup -truck -trash -"pick up".
Read more >Searching for an Exact Term - Coveo Documentation
In the search box, type the exact desired term preceded by the plus sign ( + , the exact match prefix), and then...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, kibana uses the
query_string
query so you can have the exact same functionality by using that:s = s.query('query_string', query='"Donald Trump"')
I would however recommend more granular approach using either a
phrase
orterms
queries -phrase
(0) is useful if the string you are looking for is somewhere in a field, but not exactly the match, it will also work with typetext
(analyzed).If you want to do true exact matching you need to use
keyword
type fields and aterm
query (1). That will do exact match against a field:s = s.query('term', full_name="Donald Trump")
Hope this helps
0 - https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query-phrase.html 1 - https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-term-query.html
@balaa you cannot really have a universal search like that for exact matches since it depends on the mappings also you cannot effectively search for an exact substring. The best approximation would be to use a
phrase
query as mentioned.