ElasticSearch使用過程中的常用問題

ES版本號7.1.0  Transport 7.1.0(當然不建議使用p2p的方式了,這裏只是爲了學習這種方式)

依賴參考地址:https://mvnrepository.com/

ElasticSearch常用問題:

1:

{
  "error" : "Content-Type header [application/x-www-form-urlencoded] is not supported",
  "status" : 406
}

原因:es6.0之後官方部分調整

curl -H "Content-Type: application/json" -X POST 

加上 -H "Content-Type: application/json"

 

2、

解決辦法:引入依賴

<dependency>
   <groupId>org.elasticsearch.plugin</groupId>
   <artifactId>transport-netty4-client</artifactId>
   <version>7.1.0</version>
</dependency>

如果加了後報這個錯誤:

java.lang.NoSuchMethodError: io.netty.util.AttributeKey.newInstance(Ljava/lang/String;)Lio/netty/util/AttributeKey; 

那麼遺憾的是,你也入坑了。此處是你的project中netty的版本衝突,可以通過mvn 命令瞭解衝突包,但是不建議採用,因爲那個對於依賴多的project的話會看花眼的,推薦使用maven helper 插件。移除衝突的包即可。

3、

Rejecting mapping update to [XXX] as the final mapping would have more than 1 type: [XXX, XX]"

6.0的版本不允許一個index下面有多個type

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章