Elastics的一些基本概念理解

一、Mysql与Elasticsearch核心概念对应关系

1、插入一条记录
PUT http://192.168.78.200:9201/blog/ariticle/5
{
      "title":"New version of Elasticsearch released!",
      "content":"Version 1.0 released today!",
      "tags":["announce","elasticsearch","release"]
}

执行结果:

{
      "_index" : "blog",
      "_type" : "ariticle",
      "_id" : "5",
      "_version" : 1,
      "result" : "created",
      "_shards" : {
            "total" : 2,
            "successful" : 2,
            "failed" : 0
       },
      "_seq_no" : 5,
      "_primary_term" : 1
}

相当于向blog数据库中的article数据表,插入了一行记录,该记录主键ID是5

2、查询一条记录
GET http://192.168.78.200:9201/blog/ariticle/5

执行结果:

{
    "_index": "blog",
    "_type": "ariticle",
    "_id": "5",
    "_version": 1,
    "_seq_no": 5,
    "_primary_term": 1,
    "found": true,
    "_source": {
        "title": "New version of Elasticsearch released!",
        "content": "Version 1.0 released today!",
        "tags": [
            "announce",
            "elasticsearch",
            "release"
        ]
    }
}

相当于从blog数据库中的article数据表里,获取ID值为5的记录