POST /t1/_doc/
{"name":"cat","age":"18","address":"BJ","job":"dev"}
POST /t1/_doc/
{"name":"dog","age":"19","address":"SD","job":"ops"}
POST /t1/_doc/
{"name":"alice","age":"20","address":"BJ","job":"dev"}
POST /t1/_doc/
{"name":"tigger","age":"20","address":"AH","job":"ops"}
POST /t1/_doc/
{"name":"fix","age":"21","address":"HN","job":"dev"}
POST /t1/_doc/
{"name":"jack","age":"18","address":"BJ","job":"dev"}
POST /t1/_doc/
{"name":"Tom","age":"21","address":"HN","job":"ops"}
2.查询
#term查询,是根据具体的字段进行查询#查询所有
GET t1/_search#查询name为cat的
GET t1/_search
{"query":{"term":{"name.keyword":{"value":"cat"}}}}#查询地区为北京的
GET t1/_search
{"query":{"term":{"address.keyword":{"value":"BJ"}}}}#bool查询 逻辑判断是否
bool组合语法
must:必须符合,包含 与AND等价
should:满足任意的条件, 与or等价
filter:必须满足,是否命中,不计算分值,等同must
must_not: 必须不符合不包含 与not等价#查询工作为ops的,且年龄为19到20岁的
GET t1/_search
{"query":{"bool":{"must":[{"match":{#我要查询job必须是包含ops的"job":"ops"}}],"filter":[{"range":{"age.keyword":{"gte":19,"lte":20}}}]}}}
Web服务器可以接收浏览器的请求,并将服务器中的web项目资源响应给浏览器,浏览器与服务器之间进行网络通信遵循HTTP协议。 一、什么是HTTP协议 超文本传输协议(HTTP,HyperText Transfer Protocol)(浏览器---->web服务…
项目中用到了 elasticsearch,发现有几种查询方式不太一样,思考了一下,总结如下 普通分页
等同于关系数据库的分页查询,例如 mysql 的 limit,如下 sql
select * from test limit 100000,10
这种查询方式有一个问题&a…
一 概述 c 11 中新引入了关键字 using
二 using 关键字的用处 1. using namespace 与 using namespace member #include<vector>
#include<list>int main()
{using namespace std;vector<int> vec {1, 2, 3};using std::list;list<int> li {1,…