Elasticsearch 6.x 基本觀念

  • 150
  • 0

雖然網上也很多了,但為了自己看的清楚也算整理給自己看的

關聯式資料庫 ElasticSearch
database index
table type
row document
column field
schema mapping

首先是對照表,對應如我使用的是mssql,則對應elasticsearch如上圖,以下圖一筆資料的資料結構來看

{
  "took": 9,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 1,
    "max_score": 13.754099,
    "hits": [
      {
        "_index": "nfs",
        "_type": "luceneindex",
        "_id": "kKlZqm0BQjPxKwc5DooX",
        "_score": 13.754099,
        "_source": {
          "fId": "_A7AIH__.__9",
          "folder": "收文",
          "fTitle": "",
          "fExten": "msg",
          "client": "L00640",
          "matter": "IT406B",
          "edocid": "099999999",
          "createUser": "BPE",
          "createDate": "",
          "isAttachment": "N",
          "from": "KKO",
          "tou": "BruseZhang bpe@leeandli.com [Bruse]",
          "cC": "",
          "bCC": "",
          "content": "test123",
          "PropId": 123
        }
      }
    ]
  }
}

查詢的結果會回傳兩個區塊

其一為:查詢完成的資訊

took:9  -> 查詢時間為:9 毫秒

timed_out:false -> 是否超時

_shards -> 參與的分片資訊

 

其二為:查詢完成的結果

_index:nfs  -> 資料庫名稱為:nfs

_type:luceneindex  -> 資料表名稱為:luceneindex

_id:kKlZqm0BQjPxKwc5DooX -> 該筆資料id為:kKlZqm0BQjPxKwc5DooX