Elasticsearch kibana官方基礎本地實踐

官方資源連接web

  •   https://www.elastic.co/cn/start
  •   elasticsearch官方基礎視頻教程
  •   https://www.elastic.co/cn/webinars/getting-started-elasticsearch?elektra=startpage
  •   kibana官方基礎視頻教程
  •   https://www.elastic.co/cn/webinars/getting-started-kibana?elektra=startpage

動手實踐windows

當前最新版本  Elasticsearch 7.7.0瀏覽器

運行環境elasticsearch

  • a.JDK8+
  • b.系統可用內存>2G
  • c.win7

下載 我的以爲迅雷相對較快工具

  • https://artifacts.elastic.co/downloads/kibana/kibana-7.7.0-windows-x86_64.zip
  • https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.7.0-windows-x86_64.zip

解壓運行啓動服務spa

​elasticsearch/bin
elasticsearch.bat
#編輯
kibana.yml 
elasticsearch.hosts: ["http://localhost:9200"]
#若elasticsearch開啓用戶密碼則須要配置
elasticsearch.username: "elastic"
elasticsearch.password: "changeme"
國際化中文界面開啓
i18n.locale: "zh-CN"
#雙擊啓動
bin/kibana.bat
#瀏覽器訪問  
http://localhost:5601/

 

 

 菜單點擊dev-tools工具進行基本使用調試 調試

計算集羣中文檔的數量
GET _count
{
    "query": {
        "match_all": {}
    }
}

添加文檔

PUT  testuser/_doc/1
{
  "name":"kuKi",
  "address":"北京",
  "sex":"",
  "about":"runing climbing joking",
  "age":24
}

檢索文檔

GET  testuser/_doc/1

搜索所有文檔

GET  testuser/_search

URL參數搜索

GET  testuser/_search?q=address:上海

表達式搜索 match查詢

GET testuser/_search
{"query":{ "match": { "address": "上海" } }}

表達式 匹配加過濾

GET  testuser/_search
{
  "query":{
    "bool": {
      "must": [
        {"match": {
          "address": "上海"
        }}
      ],
      "filter": [
        {
         "range": {
           "age": {
             "gte": 15,
             "lte": 25
           }
         }
        }
      ]
    }
  }
}

全文檢索

GET  testuser/_search
{
  "query": {
    "match": {
      "address": "北京"
    }
  }
}

檢索短語搜索

GET  testuser/_search
{
  "query": {
    "match_phrase": {
      "about": "runing climbing"
    }
  }
}

高亮檢索結果顯示

GET  testuser/_search
{
  "query": {
    "match_phrase": {
      "about": "runing climbing"
    }
  },
  "highlight": {
    "fields": {
      "about": {}
    }
  }
}

聚合分析

GET  testuser/_search
{
  "query":{
    "bool": {
      "must": [
        {"match": {
          "address": "上海"
        }}
      ],
      "filter": [
        {
         "range": {
           "age": {
             "gte": 15,
             "lte": 25
           }
         }
}]}}}

分詞處理

GET  testuser/_analyze
{
  "text": ["goods morning every body"]
}

更多特性

suggestions、geolocation、percolation、fuzzy 與 partial matching 等特性後面繼續慢慢研究code

相關文章
相關標籤/搜索