ElasticSearch7.6學習使用及問題總結


Elasticsearch 7 報錯:

 

 

原因:elasticsearch7默認不在支持指定索引類型,默認索引類型是_doc,如果想改變,則配置include_type_name: true 即可(這個沒有測試,官方文檔說的,無論是否可行,建議不要這么做,因為elasticsearch8后就不在提供該字段)。官方文檔:https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html

下面的指令在ES6沒問題:

PUT test_index
{
  "settings":{
    "number_of_shards":1, 
    "number_of_replicas":0     
  },
  "mappings":{
    "product": {
      "properties": {
        "title": {"type": "text"}
      }
    }
  }
}

*****product為指定索引類型

ES7必須改為:

PUT test_index
{
  "settings":{
    "number_of_shards":1, 
    "number_of_replicas":0     
  },
  "mappings":{
      "properties": {
        "title": {"type": "text"}
    }
  }
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM