More info...trying to figure out why this query throws exception. org.elasticsearch.search.SearchParseException: [example][1]: from[-1],size[-1]: Parse Failure [Failed to parse source [ { "query": { "query_string": { "query": "name:exampleof\ bug" } } } ]] at org.elasticsearch.search.SearchService.parseSource(SearchService.java:664) at org.elasticsearch.search.SearchService.createContext(SearchService.java:515) at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:487) at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:256) at org.elasticsearch.search.action.SearchServiceTransportAction$5.call(SearchServiceTransportAction.java:206) at org.elasticsearch.search.action.SearchServiceTransportAction$5.call(SearchServiceTransportAction.java:203) at org.elasticsearch.search.action.SearchServiceTransportAction$23.run(SearchServiceTransportAction.java:517) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) Caused by: org.elasticsearch.index.query.QueryParsingException: [example] Failed to parse at org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:270) at org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:263) at org.elasticsearch.search.query.QueryParseElement.parse(QueryParseElement.java:33) at org.elasticsearch.search.SearchService.parseSource(SearchService.java:648) ... 9 more Caused by: org.elasticsearch.common.jackson.core.JsonParseException: Unrecognized character escape ' ' (code 32) at [Source: [B@685c9be8; line: 5, column: 33] at org.elasticsearch.common.jackson.core.JsonParser._constructError(JsonParser.java:1419) at org.elasticsearch.common.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:508) at org.elasticsearch.common.jackson.core.base.ParserMinimalBase._handleUnrecognizedCharacterEscape(ParserMinimalBase.java:485) at org.elasticsearch.common.jackson.core.json.UTF8StreamJsonParser._decodeEscaped(UTF8StreamJsonParser.java:2924) at org.elasticsearch.common.jackson.core.json.UTF8StreamJsonParser._finishString2(UTF8StreamJsonParser.java:2209) at org.elasticsearch.common.jackson.core.json.UTF8StreamJsonParser._finishString(UTF8StreamJsonParser.java:2165) at org.elasticsearch.common.jackson.core.json.UTF8StreamJsonParser.getText(UTF8StreamJsonParser.java:279) at org.elasticsearch.common.xcontent.json.JsonXContentParser.text(JsonXContentParser.java:85) at org.elasticsearch.index.query.QueryStringQueryParser.parse(QueryStringQueryParser.java:131) at org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:234) at org.elasticsearch.index.query.IndexQueryParserService.innerParse(IndexQueryParserService.java:342) at org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:268) ... 12 more
On Thursday, August 21, 2014 10:56:24 AM UTC-7, ben wrote: > > In the ES documentation there is a list of reserved characters. > > I'm looking for the unit tests that test reserved characters inside a > query_string query. > > Could someone kindly point me in the right direction? > > Thanks! > > If you need to use any of the characters which function as operators in > your query itself (and not as operators), then you should escape them with > a leading backslash. For instance, to search for (1+1)=2, you would need > to write your query as \(1\+1\)=2. > > The reserved characters are: + - && || ! ( ) { } [ ] ^ " ~ * ? : \ / > > Failing to escape these special characters correctly could lead to a > syntax error which prevents your query from running. > > *Watch this space* > > A space may also be a reserved character. For instance, if you have a > synonym list which converts "wi fi" to "wifi", a query_string search for "wi > fi" would fail. The query string parser would interpret your query as a > search for "wi OR fi", while the token stored in your index is actually > "wifi". Escaping the space will protect it from being touched by the > query string parser: "wi\ fi". > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e4d302c4-5f9c-40a5-a54c-48d9b671220a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.