遇到的問(wèn)題
springboot 在使用ES時(shí),主程序可以正常啟動(dòng),但是新增數(shù)據(jù)時(shí)報(bào)錯(cuò)。
此時(shí)檢查es發(fā)現(xiàn)索引已經(jīng)建立成功,但是新增數(shù)據(jù)的時(shí)候報(bào)錯(cuò)。找了很久的原因。報(bào)錯(cuò)如下所示
Unable to parse response body for Response{requestLine=POST /article/_doc?timeout=1m HTTP/1.1, host=http://127.0.0.1:9200, response=HTTP/1.1 201 Created
原因分析
es版本迭代很快
springboot2.6.x版本使用ES7.x比較好。
SpringData官方的ElasticSearch版本支持簡(jiǎn)介文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-537988.html
解決方法
換一個(gè)版本下載,看看自己的項(xiàng)目對(duì)應(yīng)的版本,根據(jù)spring提供的版本支持去找個(gè)適合你自己的。
我這里提供一個(gè)支持springboot2.6.x的ES7.15.x的下載鏈接
官方鏈接ES7.15.2文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-537988.html
到了這里,關(guān)于springboot使用elasticsearch新增時(shí)報(bào)錯(cuò)Unable to parse response body for Response{requestLine=POST的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!