GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - avidbyte/ESCurlGen: 生成 es curl 命令的小工具

BranchesTags
Open more actions menu

Latest commit

 

History

21 Commits
21 Commits

Folders and files

NameName
Last commit message
Last commit date
LICENSE
LICENSE
 
 
README.md
README.md
 
 
Snipaste_2024-10-15_17-44-58.png
Snipaste_2024-10-15_17-44-58.png
 
 
index.html
index.html
 
 

Repository files navigation

ESCurlGen

由于经常编写复杂的 Elasticsearch 查询,并通过代码生成查询条件,我发现每次使用 curl 请求 Elasticsearch 时,手动复制配置信息并构建 curl 命令的过程非常繁琐,尤其是在管理多个环境的情况下更为不便。因此,我利用 AI 技术开发了一款 Web 工具,经过一系列优化和改进,该工具能够智能拼接配置信息,自动生成完整的 Elasticsearch curl 命令,极大提升了工作效率。 工具截图

访问地址可直接使用(需科学上网) https://avidbyte.github.io/ESCurlGen/

功能介绍 测试示例 my_user_index 索引

1.创建索引

{
  "mappings": {
    "properties": {
      "id": { "type": "keyword" },
      "name": { "type": "text", "fields": { "keyword": { "type": "keyword" } } },
      "phone": { "type": "text", "fields": { "keyword": { "type": "keyword" } } },
      "birthday": { "type": "date" },
      "createTime": { "type": "date" }
    }
  }
}

2.新增索引字段

{
  "properties": {
    "address": { "type": "text", "fields": { "keyword": { "type": "keyword" } } }
  }
}

3.查询 settings

4.查询 Mapping

5.新增数据

{
  "id": "1",
  "name": "John Doe",
  "phone": "123-456-7890",
  "birthday": "1990-01-01",
  "createTime": "2023-10-10T08:00:00Z",
  "address": "123 Main St"
}
{
  "id": "2",
  "name": "Jane Smith",
  "phone": "098-765-4321",
  "birthday": "1985-05-05",
  "createTime": "2023-10-11T09:00:00Z",
  "address": "456 Oak Ave"
}

6.批量操作(批量新增)

{ "index": { "_id": "3" } }
{ "name": "User One", "phone": "1234567890", "birthday": "1995-05-05", "createTime": "2024-10-17T10:00:00", "address": "789 Elm St" }
{ "index": { "_id": "4" } }
{ "name": "User Two", "phone": "0987654321", "birthday": "1988-07-15", "createTime": "2024-10-17T11:00:00", "address": "1234 Oak St" }

7.查询索引数据条数

8.根据条件查询

{
  "query": {
    "match": {
      "name": "John Doe"
    }
  }
}

9.根据 ID 查询

10.滚动查询

{
  "size": 2,
  "query": {
    "match_all": {
    }
  }
}

在初次滚动查询后,您需要使用 scroll_id 进行后续请求:

{
  "scroll": "1m",
  "scroll_id": "DXF1ZXJ5QW5kRmV0Y2gBAAAAAA..."
}

11.根据 ID 更新数据

{
  "doc": {
    "phone": "555-555-5555",
    "createTime": "2024-10-17T00:00:00Z"
  }
}

12.根据自定义条件更新数据

{
  "query": {
    "match": {
      "name": "Jane Doe"
    }
  },
  "script": {
    "source": "ctx._source.phone = params.phone; ctx._source.address = params.address",
    "params": {
      "phone": "5555555555",
      "address": "222 Elm St"
    },
    "lang": "painless"
  }
}

13.根据 ID 删除数据

14.根据自定义条件删除数据

{
  "query": {
    "match": {
      "name": "Jane Doe"
    }
  }
}

15.删除索引

16.批量更新文档 (2024-12-14新增)

About

生成 es curl 命令的小工具

Resources

Readme
Apache-2.0 license
Activity

Stars

3 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.