type=search_phase_execution_exception, reason=all shards failed when i send '/'


I’m using elasticSearch with RestHighLevelClient and Java. When I put query:
QueryBuilder qb = new QueryStringQueryBuilder("" + valueSearch.toLowerCase() + ""). Where valueSearch contain "/" -> example REC2/. The searchResponse = client.search(searchRequest, RequestOptions.DEFAULT) return me Caused by: org.elasticsearch.ElasticsearchStatusException: Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed].
However, when I send Rec2/2/3 or Rec// everything its ok.

Version elastic: 7.3.0

>Solution :

The query_string query has some reserved characters that you’re now allowed to use in queries (such as /), except if properly escaped.

So you should escape all reserved characters that are present in valueSearch.toLowerCase()

Leave a Reply Cancel reply