zoukankan      html  css  js  c++  java
  • es的refresh操作

      理想情况下,数据一添加到索引中,就可以搜索到,但是一般不是这样的。

    1.实验

    PUT /start/_doc/1
    {
      "name":"湖66"
    }
    GET /start/_doc/1
    

      效果:

    # PUT /start/_doc/1
    {
      "_index" : "start",
      "_type" : "_doc",
      "_id" : "1",
      "_version" : 1,
      "result" : "created",
      "_shards" : {
        "total" : 2,
        "successful" : 1,
        "failed" : 0
      },
      "_seq_no" : 0,
      "_primary_term" : 1
    }
    
    
    # GET /start/_doc/1
    {
      "_index" : "start",
      "_type" : "_doc",
      "_id" : "1",
      "_version" : 1,
      "_seq_no" : 0,
      "_primary_term" : 1,
      "found" : true,
      "_source" : {
        "name" : "湖66"
      }
    }
    

      

    2.再测

      使用链式请求命令,打开终端进行执行

    curl -X PUT localhost:9200/start/_doc/4 -H 'Content-Type:application/json' -d '{"name":"湖99"}'
    curl -X GET localhost:9200/start/_doc/_search?pretty -H 'Content-Type:application/json' 
    

      但是执行完,还是可以查询到,时间太短了,有点难实现。

    3.理论上做法

    curl -X PUT localhost:9200/star/_doc/666?refresh -H 'Content-Type:application/json' -d '{ "displayName": "杨超越" }'
    

      

    4.修改默认的更新时间

    PUT /start/_settings
    {
      "index":{
        "refresh_interval":"5s"
      }
    }
    

      再测:

      没有效果,后期看

    5.关闭刷新

    PUT /start/_settings
    {
      "index":{
        "refresh_interval":"-1"
      }
    }
    

      测试:

      发现同样没有效果

  • 相关阅读:
    HDU 3511 圆的扫描线
    POJ 2540 半平面交
    POJ 2451 半平面交nlogn
    POJ 3525 半平面交
    HDU 3629 极角排序
    POJ 1274 半平面交
    POJ 1696 凸包变形
    POJ 3384 半平面交
    Flex SDK代码规范之命名
    Flash & Flex组件优化的杀手锏callLater
  • 原文地址:https://www.cnblogs.com/juncaoit/p/12815608.html
Copyright © 2011-2022 走看看