elasticsearch-head插件基本使用


 

1. 查看搜索setting信息

  

mp_index/_settings

 

2. 設置分片數量

 

3, 修改數據刷新間隔

{
  "refresh_interval": "30s" # -1 關閉
}

# 設置為30秒刷新頻率

refresh_interval 可以在既存索引上進行動態更新。 在生產環境中,當你正在建立一個大的新索引時,可以先關閉自動刷新,待開始使用該索引時,再把它們調回來:

注意:

refresh_interval 需要一個 持續時間 值, 例如 1s (1 秒) 或 2m (2 分鍾)。 一個絕對值 1 表示的是 1毫秒 --無疑會使你的集群陷入癱瘓。

 

4. 修改索引允許最大編譯速度

{ 
   "transient": 
    { 
     "script.max_compilations_rate": "100000/1m"}
}

 

 

4. 設置返回結果最大偏移量值(Result window is too large, from + size must be less than or equal to: [10000] but was [10010])

 

5. 索引重建

POST _reindex
{
  "source": {
    "index": "twitter"
  },
  "dest": {
    "index": "new_twitter"
  }
}

# 老的索引指向新的索引, 索引中的數據會進行同步操作


 
         
 
調用 reindex 接口,接口將會在 reindex 結束后返回,而接口返回超時只有30秒,如果 reindex 時間過長,建議加上wait_for_completion=false的參數條件,這樣 reindex 將直接返回taskId

  

 

 

查看異步任務的更新情況:

GET _tasks/hhbzqEj_QMOyttrZD7oOKA:1240872784

 

 

6. 索引別名

 

 

7. 刪除數據

POST mp_accounts/mp_accounts/_delete_by_query

 

8. 新建索引之后, 定義索引屬性

 

9. 同步一個字段內容到另外一個字段

POST mp_account/mp_account/_update_by_query?wait_for_completion=false
{
  "query":{
    "bool": {
      "must_not": [{
        "exists": {
          "field":"industry_category"
        }
      }
        ]
    }
    
  },
  "script":"ctx._source.industry_category= ctx._source.temp_industry_category;"
}

 

10. 設置字段分詞

 

 

{
    "properties": {
          "title": {
             "type": "text",
             "analyzer": "ik_max_word",
             "search_analyzer": "ik_max_word"
          }
    }
}

 

11. 刪除索引中的數據

 

12. 執行查詢語句(使用post方式)

 

 

13. 創建索引

 

 

{
  "mappings" : {
    "properties" : {
      "name" : {
        "type" : "keyword"
      },
      "age" : {
        "type" : "integer"
      }
    }
  }
}

 

14. 添加數據

 

 注意: 這里需要指定索引以及文檔類型type

 


免責聲明!

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



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