Elasticsearch


常用查询命令

查询版本号 (7.6.2)

request
GET http://192.168.100.38:9200

查询健康情况

request
GET http://192.168.100.38:9200/_cluster/health?pretty

查询所有节点数

request
GET http://192.168.100.38:9200/_cat/nodes?pretty

查询所有节点信息

request
GET http://192.168.100.38:9200/_cat/allocation?pretty

查询所有索引

curl -XGET http://192.168.100.38:9200/_cat/indices?pretty
request
GET http://192.168.100.38:9200/_cat/indices?v&pretty

删除索引[可通配符]

curl -XDELETE http://192.168.100.38:9200/kms_knowledge*

查询数据结构

request
GET kms_knowledge_check/_mapping?pretty

查询索引的所有数据

request
GET kms_knowledge_check/_search?pretty

attachment

  • 查询
request
GET _ingest/pipeline
  • 删除
request
DELETE _ingest/pipeline/simple_attachment
  • 新增
request
PUT _ingest/pipeline/my_attachment
{
  "description": "Extract attachment for knowledge",
  "processors": [
    {
      "attachment": {
        "field": "knowContent"
      }
    }
  ]
}
  • 关联数据
request
PUT kms_knowledge/_doc/my_id?pipeline=my_attachment
{
  "knowContent": "e1xydGYxXGFuc2kNCkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0DQpccGFyIH0="
}
  • 查询数据
request
GET kms_knowledge/_doc/my_id
request
GET kms_knowledge_test/_search
{
  "query": {
    "match": {
      "attachment.content": "测试"
    }
  }
}
  • 更新数据
request
POST kms_knowledge/_update/string
{
  "script": {
    "source": "TemporalAccessor tem = DateTimeFormatter.ofPattern('yyyy-MM-dd HH:mm:ss', Locale.CHINA).parse(ctx._source['sysCreateTime']); ctx._source['countHot'] = 1 + tem.getLong(ChronoField.EPOCH_DAY);"
  }
}

文章作者: 艾茜茜
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 艾茜茜 !
  目录