异常问题:

Caused by: org.elasticsearch.index.query.QueryShardException: Failed to parse query [LOL: Uzi和Mlxg偶遇飞机故障, 二人被赶下飞机, Uzi句话暴露关系!]
at org.elasticsearch.index.query.QueryStringQueryBuilder.doToQuery(QueryStringQueryBuilder.java:1042) ~[elasticsearch-5.6.9.jar!/:5.6.9]
at org.elasticsearch.index.query.AbstractQueryBuilder.toQuery(AbstractQueryBuilder.java:96) ~[elasticsearch-5.6.9.jar!/:5.6.9]
at org.elasticsearch.index.query.BoolQueryBuilder.addBooleanClauses(BoolQueryBuilder.java:444) ~[elasticsearch-5.6.9.jar!/:5.6.9]
at org.elasticsearch.index.query.BoolQueryBuilder.doToQuery(BoolQueryBuilder.java:418) ~[elasticsearch-5.6.9.jar!/:5.6.9]
at org.elasticsearch.index.query.AbstractQueryBuilder.toQuery(AbstractQueryBuilder.java:96) ~[elasticsearch-5.6.9.jar!/:5.6.9]
at org.elasticsearch.index.query.QueryShardContext.lambda$toQuery$1(QueryShardContext.java:313) ~[elasticsearch-5.6.9.jar!/:5.6.9]
at org.elasticsearch.index.query.QueryShardContext.toQuery(QueryShardContext.java:325) ~[elasticsearch-5.6.9.jar!/:5.6.9]
at org.elasticsearch.index.query.QueryShardContext.toQuery(QueryShardContext.java:312) ~[elasticsearch-5.6.9.jar!/:5.6.9]
at org.elasticsearch.search.SearchService.parseSource(SearchService.java:617) ~[elasticsearch-5.6.9.jar!/:5.6.9]
at org.elasticsearch.search.SearchService.createContext(SearchService.java:485) ~[elasticsearch-5.6.9.jar!/:5.6.9]
at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:461) ~[elasticsearch-5.6.9.jar!/:5.6.9]
at org.elasticsearch.search.SearchService.executeDfsPhase(SearchService.java:226) ~[elasticsearch-5.6.9.jar!/:5.6.9]
at org.elasticsearch.action.search.SearchTransportService$5.messageReceived(SearchTransportService.java:332) ~[elasticsearch-5.6.9.jar!/:5.6.9]
at org.elasticsearch.action.search.SearchTransportService$5.messageReceived(SearchTransportService.java:329) ~[elasticsearch-5.6.9.jar!/:5.6.9]
at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-5.6.9.jar!/:5.6.9]
at org.elasticsearch.transport.TransportService$7.doRun(TransportService.java:644) ~[elasticsearch-5.6.9.jar!/:5.6.9]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:638) ~[elasticsearch-5.6.9.jar!/:5.6.9]
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-5.6.9.jar!/:5.6.9]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_172]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_172]
... 1 common frames omitted
Caused by: org.elasticsearch.common.io.stream.NotSerializableExceptionWrapper: parse_exception: Cannot parse 'LOL: Uzi和Mlxg偶遇飞机故障, 二人被赶下飞机, Uzi句话暴露关系!': Encountered "<EOF>" at line 1, column 40.
Was expecting one of:
<BAREOPER> ...
"(" ...
"*" ...
<QUOTED> ...
<TERM> ...
<PREFIXTERM> ...
<WILDTERM> ...
<REGEXPTERM> ...
"[" ...
"{" ...
<NUMBER> ...
<TERM> ...
"*" ...

1.异常原因

在搜索的时候没有对搜索的内容进行转义。

       String intro = infomationSearchReqVO.getIntro();
//转义特殊字符
String searchIntro = QueryParser.escape(intro);

官方文档上写的很清楚,获取一个被转义后的字符串。

escape
public static String escape(String s)
Returns a String where those characters that QueryParser expects to be escaped are escaped by a preceding \.
返回一个String,其中QueryParser期望被转义的那些字符被前面的转义\

最新文章

  1. .NET跨平台之运行与Linux上的Jexus服务器
  2. 超好用的网页栅格化工具: GridGuide
  3. js正则表达式校验非负整数:^\d+$ 或 ^[1-9]\d*|0$ 【转载】
  4. java web中jsp,action,service,dao,po分别是什么意思和什么作用
  5. jdk 与jre的区别
  6. CMS收集器
  7. PHP文章管理(2)
  8. activity的生命周期【转】
  9. nodejs文件操作模块FS(File System)常用函数简明总结(转)
  10. JAVA_SE基础——63.String类的常用方法
  11. 必须知道的Java八大排序算法
  12. Netty(一) SpringBoot 整合长连接心跳机制
  13. 树莓派中学TensorFlow
  14. 鼠标 DPI与CPI
  15. 在Virtualenv中使用Idle
  16. svn目标计算机主动拒绝
  17. 实现multibandblend
  18. 118. Pascal&#39;s Triangle (Array)
  19. CentOS下调整home和根分区大小的方法
  20. Major Performance Impacts

热门文章

  1. 使用Java让android手机自动执行重复重启
  2. tkinter events format
  3. 【Social listening实操】从社交媒体传播和文本挖掘角度解读《欢乐颂2》
  4. 52.纯 CSS 创作一个小球绕着圆环盘旋的动画
  5. hive 索引
  6. oracle查询重复的数据
  7. 02.centos6.4找不到ifcfg-eth0(静态ip配置)
  8. requirements.txt 的使用与创建
  9. Linux 删除指定时间的文件
  10. hadoop配置2.6.1 centos7