ElasticSearch+Springboot的例子,对本机的文本等文件进行全文检索
http://localhost:9200/article/_search?q=%E7%A8%8B%E5%BA%8F%E5%91%98
2017.10.10 完成基本功能,能全文搜索,能显示能分页。
在 elasticsearch-5.6.2\config\elasticsearch.yml
最后加入配置
http.cors.enabled : true
http.cors.allow-origin: "*"
http.cors.allow-methods: OPTIONS, HEAD, GET, POST, PUT, DELETE
http.cors.allow-headers: X-Requested-With,X-Auth-Token,Content-Type,Content-Length
http.cors.allow-credentials: true
query: {
match: {
body: key
}
},
修改为
query: {
match_phrase: {
body: key
}
},
_source: {
//includes: [
// '*.count',
// 'meta.*'
//],
excludes: ['body']
},
- 注入的类型不对导致无法启动
@Autowired
TransportClient client;
无法启动,修改为以下代码启动正常。
@Autowired
Client client