第三节 ElasticSearch命令

elasticsearch中的API

1、查看API

查看别名接口(_cat/aliases): 查看索引别名 查看分配资源接口(_cat/allocation) 查看文档个数接口(_cat/count) 查看字段分配情况接口(_cat/fielddata) 查看健康状态接口(_cat/health) 查看索引信息接口(_cat/indices) 查看master信息接口(_cat/master) 查看nodes信息接口(_cat/nodes) 查看正在挂起的任务接口(_cat/pending_tasks) 查看插件接口(_cat/plugins) 查看修复状态接口(_cat/recovery) 查看线城池接口(_cat/thread_pool) 查看分片信息接口(_cat/shards) 查看lucence的段信息接口(_cat/segments)

1、查询ElasticSearch基本信息

curl http://10.130.202.111:9200/?pretty

2、获取所有索引:

curl http://10.130.202.111:9200/_search?pretty=true

3、查询某个index下所有的type:

curl http://10.130.202.111:9200/bank/_search?pretty=true

4、检索所有

curl -XPOST localhost:9200/_all/_search?pretty -d '{"query":{"match_all":{}}}'

5、使用通配符

curl -XPOST localhost:9200/test*/_search?pretty -d '{"query":{"match_all":{}}}'

curl http://10.130.202.111:9200/_cat/indices?v

[root@t0-security-tdas02 ~]# curl http://10.130.202.111:9200/bank?pretty=true 
{
  "bank" : {
    "aliases" : { },
    "mappings" : {
      "account" : {
        "properties" : {
          "account_number" : {
            "type" : "long"
          },
          "address" : {
            "type" : "string"
          },
          "age" : {
            "type" : "long"
          },
          "balance" : {
            "type" : "long"
          },
          "city" : {
            "type" : "string"
          },
          "email" : {
            "type" : "string"
          },
          "employer" : {
            "type" : "string"
          },
          "firstname" : {
            "type" : "string"
          },
          "gender" : {
            "type" : "string"
          },
          "lastname" : {
            "type" : "string"
          },
          "state" : {
            "type" : "string"
          }
        }
      }
    },
    "settings" : {
      "index" : {
        "creation_date" : "1470391926065",
        "number_of_shards" : "5",
        "number_of_replicas" : "1",
        "uuid" : "4lsoesu3TqWIZaec86kUyw",
        "version" : {
          "created" : "2030399"
        }
      }
    },
    "warmers" : { }
  }
}

results matching ""

    No results matching ""