kibana的使用

#
GET _cat/health?v

# 查看索引
GET _cat/indices?v

查询多个ids

GET user/info/_mget
  {
    "ids":["137******","152******"]
 }
查询一条
GET user/info/_search?q=msisdn: 137******

创建索引,一旦创建不能修改

put  索引名

{  “settings”:{ "index":{

     "number_of_shards":5

      "number_of_replicas":1

      }

   }

}

添加一条数据

PUT xinmei/user_info/15

{

  "create_by": 156,

          "star_level": "3",

          "pre": "20",

          "level": "2",

          "name": "江*荣"

}

批量添加

POST  /lib/info/_bulk

{"index":{"_id":1}}

{"title":java,"price":55}

{"index":{"_id":2}}

{"title":"php","price":35}

修改一个字段

POST  lib/info/_update

{"doc":{

   "age":33

  }

}

mget

GET  lib/info/_mget

{ "ids":["1","2","3"]
}

term查询

GET /lib3/user/_searche

{ “query”:{

“term”:{“name”:”zhaoliu”}

}

}

term和terms

term query会去倒排索引中寻找确切的term,它并不知道分词器的存在,这种查询适合keyword,numeric,date

term:查询某个字段里含有某个关键词的文档

GET /lib/info/_search/{"query":{"term":{"interests":"chue"}}}

terms:查询某个字段里含有多个关键词的文档

GET /lib/info/_search/{"query":{"terms":{"interests":["hh","chue"]}}}

GET /lib/info/_serach

{   "from":0,

     "size":2,

       "query":{

           "terms":{

              "interests":["hh","chue"] 

             }

      }

}

GET /lib/info/_serach

{  "query":{

           "match":{

              "name":"hh","chue" 

             }

      }

}

GET /lib/info/_serach

{  "query":{

           "multi_match":{

            "query":"che",

              "fields":["age","name"] 

             }

      }

}

 

GET /lib/info/_serach

{  "query":{

           "match_phrase":{

              "interests":"age","name" 

             }

      }

}

GET /lib/info/_serach

   "query":{

           "match_all":{}

      },

"_source":{

    "includes":["name","address"],

     "excludes":["age","birthday"]

    }

}

排序

GET /lib/info/_search {"query":{"match_all":{}},"sort":[{"age":{"order":"asc/desc"}}]}

前缀匹配 match_phrase_prefix

GET /lib/info/_serach

{  "query":{

           "match_phrase_prefix":{

              "name":{  "query":"zz"

                    } 

             }

      }

}

查询范围:

GET /lib/info/_serach

{  "query":{

           "range":{

              "age":{ "from":20

                            "to":25

                          "include_lower":true

                          "include_upper":false

                  }

             }

      }

}

通配符查询

GET /lib/info/_search

{"query":{"wildcard":{"name":"li?l"}}}

fuzzy实现模糊查询

GET /lib/info/_search

{"query":{"fuzzy":{"name":"hh"}}}

-----------------------

GET ur_p/_search
{
  "query": {
    "bool": {
      "should": [
        {
          "match": {
            "city": "深圳市"
          }
        },
        {
          "match": {
            "province": "广东"
          }
        }
      ]
    }
  }
}

---------------------------

 

猜你喜欢

转载自blog.csdn.net/qq_39142369/article/details/85319155