es问题程序都能正常运行,但是es报了一个异常

来源:7-5 -Elasticsearch 实-文档、资源库、测试用例

慕仙4974986

2018-01-01

es是安装在cenos7.0上的 es版本2.4.4

--------------------------------------------------------------

@Test

public void testFindDistinctEsBlogByTitleContainingOrSummaryContainingOrContentContaining() {

Pageable pageable = new PageRequest(0, 20);

String title = "思";

String summary = "相思";

String content = "相思";

Page<EsBlog> page = esBlogRepository.findDistinctEsBlogByTitleContainingOrSummaryContainingOrContentContaining(title, summary, content, pageable);

assertThat(page.getTotalElements()).isEqualTo(2);

System.out.println("...............start");

for (EsBlog esBlog : page.getContent()) {

System.out.println(esBlog.toString());

}

System.out.println("...............end");

}


--------------结果能正常显示

...............start

EsBlog[id='AWCs5uiA58QWs6Mq5-HS',title='相思',summary='王维的相思',content='红豆生南国,春来发几枝。愿君多采撷,此物最相思。']

EsBlog[id='AWCs5uig58QWs6Mq5-HT',title='静夜思',summary='李白的静夜思',content='床前明月光,疑是地上霜,举头望明月,低头思故乡。']

...............end

------------es可以正常使用显示结果,但是Centos上的es会报下面这个异常------------

[2017-12-31 18:27:39,192][DEBUG][action.search ] [Human Cannonball] [2] Failed to execute query phase

RemoteTransportException[[Human Cannonball][192.168.0.103:9300][indices:data/read/search[phase/scan/scroll]]]; nested: SearchContextMissingException[No search context found for id [2]];

Caused by: SearchContextMissingException[No search context found for id [2]]

        at org.elasticsearch.search.SearchService.findContext(SearchService.java:626)

        at org.elasticsearch.search.SearchService.executeScan(SearchService.java:318)

        at org.elasticsearch.search.action.SearchServiceTransportAction$SearchScanScrollTransportHandler.messageReceived(SearchServiceTransportAction.java:433)

        at org.elasticsearch.search.action.SearchServiceTransportAction$SearchScanScrollTransportHandler.messageReceived(SearchServiceTransportAction.java:430)

        at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33)

        at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:77)

        at org.elasticsearch.transport.TransportService$4.doRun(TransportService.java:378)

        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

        at java.lang.Thread.run(Thread.java:748)


写回答

1回答

老卫

2018-01-01

可能是你操作系统的字符设置问题。建议你把中文改为英文再测试下、~

0
2
老卫
回复
慕仙4974986
现在我不常用这个了。、,你自己上网查下吧~ 或者,你把代码里面的中文改为英文试下
2018-01-01
共2条回复

基于Spring Boot技术栈博客系统企业级前后端实战

毕设 Elasticsearch搜索+Thymeleaf模板+JPA+Security+BootStrap

1296 学习 · 738 问题

查看课程