Open lqshow opened 6 years ago
返回集群中所有索引下的所有文档
curl -XGET 'localhost:9200/_search?pretty'
curl -XGET 'localhost:9200/_search?pretty' -H 'Content-Type: application/json' -d' { "query": { "match_all": {} } } '
curl -XGET 'localhost:9200/megacorp/employee/_search?pretty' -H 'Content-Type: application/json' -d' { "query" : { "match" : { "last_name" : "Smith" } } } '
curl -XGET 'localhost:9200/megacorp/employee/_search?pretty' -H 'Content-Type: application/json' -d' { "query" : { "bool": { "must": { "match" : { "last_name" : "smith" } }, "filter": { "range" : { "age" : { "gt" : 30 } } } } } } '
curl -XGET 'localhost:9200/megacorp/employee/_search?pretty' -H 'Content-Type: application/json' -d' { "query" : { "match" : { "about" : "rock climbing" } } } '
curl -XGET 'localhost:9200/megacorp/employee/_search?pretty' -H 'Content-Type: application/json' -d' { "query" : { "match_phrase" : { "about" : "rock climbing" } } } '
curl -XGET 'localhost:9200/megacorp/employee/_search?pretty' -H 'Content-Type: application/json' -d' { "query" : { "match_phrase" : { "about" : "rock climbing" } }, "highlight": { "fields" : { "about" : {} } } } '
curl -XGET 'http://localhost:9200/xdp-fusion-index/Patients/bb-25948f88457ce8d62caa0ae516462229?pretty'
curl -X GET \ -d '{ "query" : { "bool": { "filter":{ "term": { "bbPatientId.keyword":"bb-4cd56a7f-57f1-40c9-9983-96169f717b7d" } } } } }' \ http://localhost:9200/xdp-fusion-index/Patients/_search
curl -X GET \ -d '{ "query":{ "bool":{ "must":[ { "range":{ "mergedDemo.BIRTH_DATE.value":{ "format":"yyyy-MM-dd", "gte":"1967-01-01", "lt":"1972-01-01" } } } ] } } }' \ http://localhost:9200/xdp-fusion-index/Patients/_search
curl -X GET \ -d '{ "query":{ "bool":{ "must":[ { "terms":{ "bbPatientId": ["bb-25948f88457ce8d62caa0ae516462229"] } } ] } } }' \ http://localhost:9200/xdp-fusion-index/Patients/_search
curl -X GET \ -d '{ "query":{ "bool":{ "must":[ { "term":{ "bbPatientId": "bb-25948f88457ce8d62caa0ae516462229" } } ] } } }' \ http://localhost:9200/xdp-fusion-index/Patients/_search
curl -X GET \ -d '{ "query":{ "bool":{ "must":[ { "match_phrase":{ "bbPatientId":"bb-4cd56a7f-57f1-40c9-9983-96169f717b7d" } } ] } } }' \ http://localhost:9200/xdp-fusion-index/Patients/_search
curl -X GET \ -d '{ "query":{ "bool":{ "must":[ { "wildcard": { "mergedDemo.ID_NO.value": "*" + value + "*" } } ] } } }' \ http://localhost:9200/xdp-fusion-index/Patients/_search
curl -XGET 'localhost:9200/gb/tweet/_validate/query?explain&pretty' -H 'Content-Type: application/json' -d' { "query": { "match" : { "tweet" : "really powerful" } } } '
curl -XGET 'localhost:9200/accounts/person/_search' -d ' { "query":{ "match":{ "desc":"软件 系统" } } } '
curl -XGET 'localhost:9200/accounts/person/_search' -d ' { "query": { "bool": { "must": [ { "match": { "desc": "软件" } }, { "match": { "desc": "系统" } } ] } } }'
空搜索
返回集群中所有索引下的所有文档
简单查询
复杂查询
全文搜索(在全文属性【独立单词(分词) or关系】上搜索并返回相关性最强的结果)
短语搜索(紧邻搜索)
高亮搜索
检索记录(通过文档ID)
精确查找(关键字后加.keyword)
范围查找(range)
一个关键字过滤内容
terms
term
紧邻搜索(match_phrase)
模糊匹配(wildcard)
验证查询
多关键字or查询
多关键字and查询