Escape reserved words in elastic search

If the query string contains type reserved words AND

or OR

how to avoid them?

Example 1: Brooklyn AND Bailey

If I query the database, it looks for documents with Brooklyn

and Bailey

instead of a string Brooklyn AND Bailey

.

Example 2: Brooklyn OR Bailey

If I query the database, it looks for documents that have either Brooklyn

or Bailey

instead of a string Brooklyn OR Bailey

.

This is my code.

esclient.search({
  from: 0,
  size: 5,
  body: {
    'query': {
      'query_string': {
        'query': 'title:' + term
      }
    }
  }
}).then(function(body) {
    // results
});

      

How do I avoid reserved words in a query?

+3
elasticsearch lucene


source to share


No one has answered this question yet

Check out similar questions:

108
How to find part of a word using ElasticSearch
78
How do I avoid characters in a GitHub code lookup?
3
Elastic search. Sort search results that start with a search term.
2
How to sort search results by value + boost + field?
2
Use * (asterix) as thermal query in Elastic search
0
Elastic Search: Query an exact match in an array of strings
0
Related words in Elasticsearch
0
Search multiple words, mark words without matching
0
How to avoid special words such as "AND", "OR" in an elastic search string
0
elasticsearch - full text search for words with special / reserved characters



All Articles
Loading...
X
Show
Funny
Dev
Pics