Elasticsearch文档、索引和rest api

2020-07-26  本文已影响0人  ajajaj

本文来自极客时间《Elasticsearch核心技术实战》 课程学习笔记,感兴趣的同学可以订阅该课程

基本概念

文档

Json文档

movieId,title,genres
1,Toy Story(1995),AdvenTure|Animation|Children|Comedy|Fantasy
{
    "year" : 1995,
    "@version" : 1,
    "genres" : [
        "AdvenTure","Animation",
        "Children","Comedy","Fantasy"
    ],
    "id" : "1",
    "title" : "Tony Story"
}

文档的元数据

{
    "_index" : "movies",
    "_type" : "_doc",
    "_id" : "1",
    "_score" : "14.626",
    "_source" : {
        "year" : 1995,
        "@version" : 1,
        "genres" : [
            "AdvenTure","Animation",
            "Children","Comedy","Fantasy"
        ],
        "id" : "1",
        "title" : "Tony Story"
    }
}

索引

{
    "movies" : {
        "settings" : {
            "index" : {
                "create_date" : "15526261177",
                "number_of_shards" : "2",
                "number_of_replicas" : "0",
                "uuid" : "",
                "verison" : {
                    "created" : "302302"
                },
                "provided_name" : "movies"
            }
        }
    }
}

索引的不同语意

image

type

抽象和类比

RDBMS Elasticsearch
Table Index(Type)
Row Document
Column Field
Schema Mapping
SQL DSL

1.7.0之前,一个index可以设置多个types

2.目前Type已经被Deprecated,7.0开始,一个索引只能创建一个Type-"_doc"

3.传统关系型数据库和Elasticsearch的区别

Rest API-很容易被各种语言调用

image

一些基本的API

原文地址

[http://cbaj.gitee.io/blog/2020/07/26/Elasticsearch%E6%96%87%E6%A1%A3%E3%80%81%E7%B4%A2%E5%BC%95%E5%92%8Crest%20api/#more](http://cbaj.gitee.io/blog/2020/07/26/Elasticsearch文档、索引和rest api/#more)

上一篇下一篇

猜你喜欢

热点阅读