zoukankan      html  css  js  c++  java
  • Elasticsearch之CURL命令的DSL查询

      它是Domain Specific Language领域特定语言。

    https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html

       大家,自行先去看。

      新添加一个文档

    [hadoop@master elasticsearch-2.4.0]$ curl -XPUT http://master:9200/zhouls/user/4/_create -d '{"name": "lily" , "age" : 18}' 
    {"_index":"zhouls","_type":"user","_id":"4","_version":1,"_shards":{"total":2,"successful":2,"failed":0},"created":true}[hadoop@master elasticsearch-2.4.0]$ 
    [hadoop@master elasticsearch-2.4.0]$ 
    [hadoop@master elasticsearch-2.4.0]$ 

      得到

      

       更多,大家可以去见官网,如下

    https://www.elastic.co/guide/en/elasticsearch/reference/current/query-filter-context.html

       复杂的查询,我们通过这种匹配match不同的字段是很有作用的。

    [hadoop@master elasticsearch-2.4.0]$ curl -XGET http://master:9200/zhouls/user/_search -d '{"query" : {"match" : {"name": "lily" }}}' 
    {"took":26,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":1.0,"hits":[{"_index":"zhouls","_type":"user","_id":"4","_score":1.0,"_source":{"name": "lily" , "age" : 18}}]}}[hadoop@master elasticsearch-2.4.0]$ 
    [hadoop@master elasticsearch-2.4.0]$ 
    [hadoop@master elasticsearch-2.4.0]$ curl -XGET http://master:9200/zhouls/user/_search -d '{"query" : {"match" : {"name": "john" }}}' 
    {"took":11,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":4,"max_score":1.0,"hits":[{"_index":"zhouls","_type":"user","_id":"2","_score":1.0,"_source":{"name" : "john"  , "age" : 28}},{"_index":"zhouls","_type":"user","_id":"1","_score":1.0,"_source":{"name" : "john"  , "age" : 28}},{"_index":"zhouls","_type":"user","_id":"AVz5Q9u7U8bDb6QDgbDS","_score":1.0,"_source":{"name" : "john"}},{"_index":"zhouls","_type":"user","_id":"3","_score":0.30685282,"_source":{"name" : "john"  , "age" : 28}}]}}[hadoop@master elasticsearch-2.4.0]$ 
    [hadoop@master elasticsearch-2.4.0]$ 
    [hadoop@master elasticsearch-2.4.0]$ 
  • 相关阅读:
    malloc 函数
    如何在Ubuntu 20.04上启用SSH
    E :仓库***没有Release文件
    Invocation of init method failed; nested exception is org.hibernate.HibernateException: could not instantiate RegionFactory [org.hibernate.cache.impl
    发送方IP地址与路由器
    计算机系统到底是个什么东东
    批量创建10个系统帐号,并设置密码(密码为随机数,要求字符和数字等混合(第一种)
    mysql主从复制
    mysql主从复制和读写分离
    系统命令大全
  • 原文地址:https://www.cnblogs.com/zlslch/p/7101443.html
Copyright © 2011-2022 走看看