zoukankan      html  css  js  c++  java
  • elasticsearch 7.6.1 常用数据查询语句

    1、创建索引 ( index)

    curl   -H'Content-Type: application/json' -XPUT http://127.0.0.1:9200/test_index/_doc/1  -d'{
    "mappings": {
      "properties": {
        "title": { "type": "text", "analyzer": "ik_smart" }, 
        "description": { "type": "text", "analyzer": "ik_smart" },
        "price": { "type": "scaled_float", "scaling_factor": 100 }
      }
    }}'
    

      

    2、增加内容

        

    curl -H'Content-Type: application/json' -XPUT http://127.0.0.1:9200/test_index/_doc/1?pretty -d'{
        "title": "iPhone X",
        "description": "新品到货",
        "price": 8848
    }'
    
    curl -H'Content-Type: application/json' -XPUT http://127.0.0.1:9200/test_index/_doc/2?pretty -d'{
        "title": "OPPO R15",
        "description": "新品到货",
        "price": 2000
    }'
    

      

    3、查询记录

        

    curl -XPOST -H'Content-Type:application/json' http://localhost:9200/test_index/_doc/_search?pretty -d'
    {
        "query" : { "match" : { "description" : "新" }}
     }'
    

    4、获得单个记录

      

    curl http://localhost:9200/test_index/_doc/1?pretty
    

      

  • 相关阅读:
    实现一个简单的ConnectionPool
    并发连接MySQL
    C#里面滥用String造成的性能问题
    String.IndexOf
    C#代码中插入X86汇编
    正确理解Handle对象
    orleans发送广播消息
    log日志方法
    PHP 批量插入数据
    逻辑漏洞小结之SRC篇
  • 原文地址:https://www.cnblogs.com/fogwang/p/12487828.html
Copyright © 2011-2022 走看看