Hello everybody.
Example i have a search query:
{"query":{"bool":{"must":[],"must_not":[],"should":[{"query_string":{"default_field":"tweet.user","query":" kompa)"}}]}},"from":0,"size":50,"sort":[],"facets":{}}, when i run this
query on elasticsearch server i will got ParseException:
But if this query:
{"query":{"bool":{"must":[],"must_not":[],"should":[{"query_string":{"default_field":"tweet.user","query":" (kompa)"}}]}},"from":0,"size":50,"sort":[],"facets":{}},
this can do search well.
So i want to check field value before executing a search.
I don't know what rule that elasticsearch used to check the field value.
I try on the elasticsearc.org but couldn't found any thing.
Because there are many case with many special characters to validate,
example: {}$%^&()@!`
IMO this is just how the lucene query parser works, you need to escape
those things.
do you need to have support for query syntax at all like boolean operators?
if not maybe match query
(Elasticsearch Platform — Find real-time answers at scale | Elastic) can
help you
simon
On Wednesday, August 28, 2013 7:59:33 PM UTC+2, Duy Binh wrote:
Hello everybody.
Example i have a search query:
{"query":{"bool":{"must":,"must_not":,"should":[{"query_string":{"default_field":"tweet.user","query":" kompa)"}}]}},"from":0,"size":50,"sort":,"facets":{}}, when i run this
query on elasticsearch server i will got ParseException:
But if this query:
{"query":{"bool":{"must":,"must_not":,"should":[{"query_string":{"default_field":"tweet.user","query":" (kompa)"}}]}},"from":0,"size":50,"sort":,"facets":{}},
this can do search well.
So i want to check field value before executing a search.
I don't know what rule that elasticsearch used to check the field
value. I try on the elasticsearc.org but couldn't found any thing.
Because there are many case with many special characters to validate,
example: {}$%^&()@!`
Thanks simmonw;
I got that elasticsearch uses Java Lucene to parse and validation the query.
But with the query:
{"query":{"bool":{"must":,"must_not":,"should":[{"query_string":{"default_field":"tweet.user","query":" (kompa)"}}]}},"from":0,"size":50,"sort":,"facets":{}}
it works; so i think no need to escape it. Do you think so ?
IMO this is just how the lucene query parser works, you need to escape
those things.
do you need to have support for query syntax at all like boolean
operators? if not maybe match query ( Elasticsearch Platform — Find real-time answers at scale | Elastic) can
help you
simon
On Wednesday, August 28, 2013 7:59:33 PM UTC+2, Duy Binh wrote:
Hello everybody.
Example i have a search query: {"query":{"bool":{"must":,"**
must_not":,"should":[{"query_string":{"default_field"
:"tweet.user","query":"kompa)"**}}]}},"from":0,"size":50,"sort":[],"facets":{}},
when i run this query on elasticsearch server i will got ParseException:
-------------------------------------------------------
Caused by: org.apache.lucene.queryparser.**classic.ParseException:
Cannot parse '(
kompa': Encountered "" at line 1, column 6.
Was expecting one of:
...
...
...
"+" ...
"-" ...
...
"(" ...
")" ...
"*" ...
"^" ...
...
...
<FUZZY_SLOP> ...
...
...
...
"[" ...
"{" ...
...
at org.apache.lucene.queryparser.**classic.QueryParserBase.parse(
**QueryPars
erBase.java:126)
========================
But if this query: {"query":{"bool":{"must":,"**
must_not":,"should":[{"query_string":{"default_field"
:"tweet.user","query":"(kompa)"}}]}},"from":0,"size":50,"
sort":,"facets":{}},
this can do search well.
So i want to check field value before executing a search.
I don't know what rule that elasticsearch used to check the field
value. I try on the elasticsearc.org but couldn't found any thing.
Because there are many case with many special characters to validate,
example: {}$%^&()@!`
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.