zoukankan      html  css  js  c++  java
  • elasticsearch RESTful

    一 、索引(index)

    1. 创建索引

    (1)第一种方式

    PUT twitter
    {
        "settings" : {
            "index" : {
                "number_of_shards" : 3,
                "number_of_replicas" : 2
            }
        }
    }

         

    (2)第二种方式

    ①:没有指定mapping

    curl -XPOST "http://127.0.0.1:9200/productindex"
    {"acknowledged":true}  

    ②:查看mapping

    curl -XGET "http://127.0.0.1:9200/productindex/_mapping?pretty" 
    {
      "productindex" : {
        "mappings" : { }
      }
    }

     2. 删除索引

    DELETE /twitter

     

    二、结构(map)

    1. 创建index的过程中创建mapper,如果已经存在则报如下错误

    PUT index_an
    {
      "mappings": {
        "egan": { 
          "properties": { 
            "title":    { "type": "string"  }, 
            "name":     { "type": "string"  }, 
            "age":      { "type": "integer" },  
            "created":  {
              "type":   "date", 
              "format": "strict_date_optional_time||epoch_millis"
            }
          }
        }
      }
    }

     

    2. 下面的错误由于:elasticsearch 2.X不支持text,好像5.X才支持,2.X使用的是string

    3. 正常如下

     4. 添加mapping

     

    5. 查看mapping

    6. 添加mapping

    {
         "product": {
                    "properties": {
                         "amount":{
                            "type":"integer"
                       }
                    }
                }
        }

    7. 查看

    8. 修改mapping

    http://www.cnblogs.com/Creator/p/3722408.html

  • 相关阅读:
    CSS练习
    大作业“抽屉页面”html+css
    html练习代码
    协程-基于TCP的高并发通信
    协程-爬虫示例
    互斥锁,递归锁,信号量
    三层架构(我的理解及详细分析)
    递归算法经典实例小结(C#实现)
    使用XmlWriter写Xml
    使用XmlReader读Xml
  • 原文地址:https://www.cnblogs.com/an5211/p/8618531.html
Copyright © 2011-2022 走看看