You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I've managed to set up Plastic as per documentation info - and works fine, thank you.
I'm having a issue where using ES "reserved characters" in queries throws a BadRequest400Exception - query_shard_exception: Failed to parse query. Example: searching for test: throws out the mentioned exception.
I am aware that this is more of a ES related issue, not Plastic's but I was wondering how others managed to get around this. Is query sanitation required, or do I need to use some regex? I know I can catch the exception, but I rather not.
Yes as per the documentation not escaping the reserved characters could lead to a syntax error. I'm still not sure if escaping those characters automatically is a good idea. Do you have any insights?
Agree, escaping the reserved characters it's probably not the way to go, and playing with this can render inaccurate search results.
What I am doing right now is allowing some of the characters (which I believe are "most used"), like + : - &, and escape the rest by using preg_replace . Those only throw the exception if a wildcard is used in query (within the controller, like in my example above). So I have removed the wildcards from the query.
This takes away some of the ES functionality, but I have nothing better so far. At least this way, I get accurate results.
Also, in this scenario I am still getting an exception error if no term is used after the search operator (for example: test + will throw the error and test +foo will parse fine). I am also catching this error.
Since ES plugs in quite a few languages, I guess it is up to the programmer to deal with search operators in queries.
I believe that this can be closed, is it not as issue with Plastic, but a request for info. Thanks again.
Hi,
I've managed to set up Plastic as per documentation info - and works fine, thank you.
I'm having a issue where using ES "reserved characters" in queries throws a BadRequest400Exception - query_shard_exception: Failed to parse query. Example: searching for test: throws out the mentioned exception.
I am aware that this is more of a ES related issue, not Plastic's but I was wondering how others managed to get around this. Is query sanitation required, or do I need to use some regex? I know I can catch the exception, but I rather not.
Example of how I am building the query:
The ES reserved characters are listed here: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#_reserved_characters
The text was updated successfully, but these errors were encountered: