1、查询所有es里的索引 有哪些 :
GET _cat/indices
2、查看es 里的插件并显示name,component,version 和description
GET /_cat/plugins?v&s=component&h=name,component,version,description
es里插件查看3、查询所有索引的总记录数:
3.1 GET /_search
3.2
GET _search
{
"query": {
"match_all": {}
}
}
4、通配符查询某些索引
GET _cat/indices/mytest*
以上是展示所有带mytest 前缀的索引
5、查询指定索引:
GET test111/_search
****查询从0开始10条,索引test111中各个字段中带有hello的。
GET test111/_search
{
"from":0,
"size":10,
"query": {
"multi_match": {
"query": "hello"
}
}
}
****multi_match 指定字段 best_fields
GET ywdj*/_search
{
"query": {
"multi_match": {
"query": "chen",
"fields": [
"OWNER_NAME",
"OWNER_NAME.raw"
],
"type": "best_fields"
}
}
}
*******multi_match 不指定字段 most_fields
GET ywdj*/_search
{
"query": {
"multi_match": {
"query": "虚拟网",
"type": "most_fields"
}
}
}
***指定索引指定字段短语查询
GET test111/_search
{
"query": {
"match_phrase": {
"PARTIES_NAME": "中国人"
}
}
}
******精确查询每个字段的某个值
GET myindex/_search
{
"query":{
"match": {
"NAME.raw": "chen"
}
}
}
GET _search
{
"query": {
"match": {
"AREA": {
"query": "电信"
}
}
}
}
*************删除test111索引
DELETE test111
***********通配符查字段
{
"multi_match": {
"query": "Quick brown fox",
"fields": "*_title"
}
}
使用curl 查询带用户名密码的方式:
curl -XGET -u elastic 'http://127.0.0.1:9200/mytestindex/_search?pretty=true'
网友评论