Failed to parse query with escaped quotation mark


(Maya) #1

Hi,

I pass the following query with escaped quotation mark:
{
"from": 0,
"size": 100,
"query": {
"query_string": {
"query":
""http://www.ynet.co.il/tags/jQuery16103187891168054193_1379319901404*"*
?"",
"fields": [
"string.VersionId"
]
}
},
"fields": [
"Id",
"string.LocalPath",
"string.VersionId",
"dateTime.CollectionTime"
]
}

and I get the error as if the quotation mark is not escaped:
Caused by: org.elasticsearch.index.query.QueryParsingException:
[monitoredqueries] Failed to parse query
["http://www.ynet.co.il/tags/jQuery16103187891168054193_1379319901404"?"]
at
org.elasticsearch.index.query.QueryStringQueryParser.parse(QueryStringQueryParser.java:225)
at
org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:193)
at
org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:272)
at
org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:250)
at
org.elasticsearch.search.query.QueryParseElement.parse(QueryParseElement.java:33)
at
org.elasticsearch.search.SearchService.parseSource(SearchService.java:561)
... 12 more
Caused by: org.apache.lucene.queryparser.classic.ParseException: Cannot
parse
'"http://www.ynet.co.il/tags/jQuery16103187891168054193_1379319901404"?"':
Lexical error at line 1, column 72. Encountered: after : ""
at
org.apache.lucene.queryparser.classic.QueryParserBase.parse(QueryParserBase.java:131)
at
org.elasticsearch.index.query.QueryStringQueryParser.parse(QueryStringQueryParser.java:213)
... 17 more

Is that a known bug?

Thanks.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Alexander Reelsen) #2

Hey,

the query_string query might not be the best solution for queries like
this, as it is using the lucene query parser (which can easily fail). You
should check out the query DSL a bit further and maybe go with a match
query or a term query - this largely depends how you want to query and what
you are expected and what kind of data you have indexed. Maybe you can
elaborate on that.

--Alex

On Tue, Sep 17, 2013 at 12:47 PM, mayap maya.pollack@gmail.com wrote:

Hi,

I pass the following query with escaped quotation mark:
{
"from": 0,
"size": 100,
"query": {
"query_string": {
"query": ""
http://www.ynet.co.il/tags/jQuery16103187891168054193_1379319901404*"*
?"",
"fields": [
"string.VersionId"
]
}
},
"fields": [
"Id",
"string.LocalPath",
"string.VersionId",
"dateTime.CollectionTime"
]
}

and I get the error as if the quotation mark is not escaped:
Caused by: org.elasticsearch.index.query.QueryParsingException:
[monitoredqueries] Failed to parse query ["
http://www.ynet.co.il/tags/jQuery16103187891168054193_1379319901404"?"]
at
org.elasticsearch.index.query.QueryStringQueryParser.parse(QueryStringQueryParser.java:225)
at
org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:193)
at
org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:272)
at
org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:250)
at
org.elasticsearch.search.query.QueryParseElement.parse(QueryParseElement.java:33)
at
org.elasticsearch.search.SearchService.parseSource(SearchService.java:561)
... 12 more
Caused by: org.apache.lucene.queryparser.classic.ParseException: Cannot
parse '"
http://www.ynet.co.il/tags/jQuery16103187891168054193_1379319901404"?"':
Lexical error at line 1, column 72. Encountered: after : ""
at
org.apache.lucene.queryparser.classic.QueryParserBase.parse(QueryParserBase.java:131)
at
org.elasticsearch.index.query.QueryStringQueryParser.parse(QueryStringQueryParser.java:213)
... 17 more

Is that a known bug?

Thanks.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(sina.tamanna) #3

Your quotation marks are unbalanced. You have one escaped quotation mark on
the left and two escaped on the right.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4