elasticsearch kibana简单使用

1、查看当前已创建索引

GET /_cat/indices?v

在这里插入图片描述
可以查看到所有索引信息
2、删除索引

DELETE /elasticsearchnews?pretty

在这里插入图片描述

3、创建索引

PUT /testindex
{
  "mappings":{
    "properties":{
      "content":{
        "type":"text"
      },
      "updateTime":{
        "type":"long"
      }
    }
  }
}

这样只适合自己测试创建索引,创建一个primary shard和一个 replica shard
4、查询—匹配指定索引下的所有数据

GET elasticsearchnews/_search
{
  "query": {
      "match_all": {
      }
  }
}

5、查询—匹配指定索引的指定列

GET /elasticsearchquestion/_search
{
  "query": {
      "match": {
        "content": "车"
      }
  }
}

6、根据字段排序

GET /elasticsearchquestion/_search
{
  "query": {
      "match": {
        "content": "车"
      }
  },
  "sort": { "updateTime": { "order": "desc" }}
}

7、ik分词测试

POST _analyze
{
  "analyzer": "ik_max_word",
  "text": "北京北京北京"
}

8、mget批量查询

GET /elasticsearchquestion/_mget  {
  "ids": ["1542819432809689090","1544938813341626370"]
}

9、mget不同索引中的文档

GET _mget
{
  "docs": [
    {
      "_index": "elasticsearchdynamic",
      "_type": "_doc",
      "_id": "1544158992981499905"
    },
    {
      "_index": "elasticsearchquestion",
      "_type": "_doc",
      "_id": "1542819432809689090"
    }
    ]
}

10、多索引搜索

GET /elasticsearchquestion,elasticsearchdynamic/_search
{
  "query": {
      "match": {
        "content": "测试问题"
      }
  }
}

11、多索引通配符搜索

GET /elasticsearch*/_search
{
  "query": {
      "match": {
        "content": "测试问题"
      }
  }
}

12、获取文档映射

GET /elasticsearchquestion/_mapping

13、bilk操作

POST _bulk
{"delete": {"_index": "elasticsearchdynamic","_id":"1567783547240366082"}}
{"delete": {"_index": "elasticsearchquestion","_id":"1567783547240312312"}}

POST _bulk
{"create": {"_index": "testindex","_id":"1"}}
{"doc": {"content": "testindex","updateTime":"134234234"}}
{"create": {"_index": "testindex","_id":"2"}}
{"doc": {"content": "testindex","updateTime":"134234234234"}}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值