• Elasticsearch 单模式下API的增删改查操作


    <pre name="code" class="html">Elasticsearch 单模式下API的增删改查操作
    
    http://192.168.32.80:9200/library/
    
                                PUT
    
    {"settings":{"index":{"number_of_shards":5,"number_of_replicas":1}}}
    
    可以通过GET带商参数settings可以获得该索引详细的配置信息:
    
    http://192.168.32.80:9200/library/_settings/
    
                                        GET
    
    {"settings":{"index":{"number_of_shards":5,"number_of_replicas":1}}}
    
    
    返回;
    
    查询
    
    {"query":{"match_all":{}}}
    易读
    结果转换器?
    重复请求
    显示选项?
    {
    
        "library": {
            "settings": {
                "index": {
                    "creation_date": "1469773369469",
                    "number_of_shards": "5",
                    "number_of_replicas": "1",
                    "uuid": "QA72b8YURSSiTFp9P8Klyg",
                    "version": {
                        "created": "2030499"
                    }
                }
            }
        }
    
    }
    
    
    ##获取所有索引信息:
    
    http://192.168.32.81:9200/_all/_settings/
    
    查询
    
    {"query":{"match_all":{}}}
    易读
    结果转换器?
    重复请求
    显示选项?
    {
    
        ".kibana": {
            "settings": {
                "index": {
                    "creation_date": "1469525519216",
                    "number_of_shards": "1",
                    "number_of_replicas": "1",
                    "uuid": "6AFgs3DmTxOu2p8Pjr1F6w",
                    "version": {
                        "created": "2030499"
                    }
                }
            }
        },
        "nginx_acc": {
            "settings": {
                "index": {
                    "creation_date": "1469197120363",
                    "number_of_shards": "5",
                    "number_of_replicas": "1",
                    "uuid": "NrankAbxS0qC2YPbT5iu5g",
                    "version": {
                        "created": "2030499"
                    }
                }
            }
        },
        "library": {
            "settings": {
                "index": {
                    "creation_date": "1469773369469",
                    "number_of_shards": "5",
                    "number_of_replicas": "1",
                    "uuid": "QA72b8YURSSiTFp9P8Klyg",
                    "version": {
                        "created": "2030499"
                    }
                }
            }
        }
    
    }
    
    5.2 API创建,删除索引
    
    
    索引/类型/id
    
    PUT /library/books/1
    
    
    
    初始 library
    size: 795B (1.55ki)
    docs: 0 (0)
    
    library 索引 0个文档:
    http://192.168.32.81:9200/libary/books/1/
    
                                   PUT
    
    {"titile":"Elasticsearch: The Defintive Guide","name":{"first":"Zachary","last":"Tong"},"publish_date":"2016-07-
    
    29","price":"59.99"}
    
    
    http://192.168.32.81:9200/libary/books/5/
                                     PUT
    
    
    {"price":"59.99"}
    
    
    GET 请求;
    
    http://192.168.32.81:9200/
    
    scan/books/2/                  GET
    
    
    
    ##获取_source 获取指定的字段:
    http://192.168.32.81:9200/
    
    scan/books/2/?_source=titile   GET
    
    
    ##我们更新同一个ID下的文档,可以通过覆盖的方式更新:
    
    http://192.168.32.81:9200/
    library/books/1                 PUT
    
    {"titile":"Elasticsearch: The Defintive Guide","name":{"first":"Zachary","last":"Tong"},"publish_date":"2016-07-
    
    29","price":"99.99"}
    
    
    
    ##或者通过_update API的方式更新你想要的字段:
    
    http://192.168.32.81:9200/
    
    library/books/1_update           PUT
    
    {"doc":{
    "price":10
     }
    }
    
    
    
    
    获取 :索引/类型/id
    
    /libarary/books下的所有id
    
    
    Elasticsearch 的内置字段以及类型
    
    内置字段: _uid,_id,_type,_source,_all,_analyzer,_boost,_parent,_routing,_index,_size,_timestamp,_ttl
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    


    
       
    
    
  • 相关阅读:
    色彩(颜色)空间原理(下)
    色彩(颜色)空间原理(中)
    色彩(颜色)空间原理(上)
    RGB Color Codes Chart
    h265webplayer
    h265player开发
    ffmpeg architecture(下)
    java遍历复杂json字符串获取想要的数据
    对List集合嵌套了map集合对double值进行排序
    java 实现递归实现tree
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/6199472.html
Copyright © 2020-2023  润新知