Index API

作者: 风云傲天 | 来源:发表于2018-11-15 00:08 被阅读0次

    Index API

    创建索引

    PUT my_index
    PUT my_index
    {
        "settings": {},
        "mappings": {}
    }
    PUT my_index/_doc/1
    {
        "name": "test name"
    }
    

    op_type: create or index

    PUT my_index/_doc/1?op_type=index
    {
      "first_name": "John",
      "last_name": "Smith"
    }
    

    version_type: internal or external or external_gte
    internal: 当version == 当前文档的version才可以操纵成功
    external: 当version > 当前文档的version才可以操纵成功
    external_gte: 当version >= 当前文档的version才可以操纵成功

    PUT my_index/_doc/1?version=11&version_type=internal
    {
      "first_name": "John",
      "last_name": "Smith"
    }
    

    自动ID

    POST twitter/_doc/
    {
        "user" : "kimchy",
        "post_date" : "2009-11-15T14:12:12",
        "message" : "trying out Elasticsearch"
    }
    

    routing

    POST twitter/_doc?routing=kimchy
    {
        "user" : "kimchy",
        "post_date" : "2009-11-15T14:12:12",
        "message" : "trying out Elasticsearch"
    }
    

    相关文章

      网友评论

          本文标题:Index API

          本文链接:https://www.haomeiwen.com/subject/ftqefqtx.html