mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 09:34:05 +08:00
opt some
This commit is contained in:
parent
13714d65b7
commit
7c587d6bc9
@ -1,83 +0,0 @@
|
||||
package es
|
||||
|
||||
import (
|
||||
ice "github.com/shylinux/icebergs"
|
||||
"github.com/shylinux/icebergs/base/web"
|
||||
"github.com/shylinux/icebergs/core/code"
|
||||
kit "github.com/shylinux/toolkits"
|
||||
|
||||
"path"
|
||||
"runtime"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const ES = "es"
|
||||
|
||||
var Index = &ice.Context{Name: ES, Help: "搜索",
|
||||
Configs: map[string]*ice.Config{
|
||||
ES: {Name: ES, Help: "搜索", Value: kit.Data(
|
||||
"address", "http://localhost:9200",
|
||||
"windows", "https://elasticsearch.thans.cn/downloads/elasticsearch/elasticsearch-7.3.2-windows-x86_64.zip",
|
||||
"darwin", "https://elasticsearch.thans.cn/downloads/elasticsearch/elasticsearch-7.3.2-darwin-x86_64.tar.gz",
|
||||
"linux", "https://elasticsearch.thans.cn/downloads/elasticsearch/elasticsearch-7.3.2-linux-x86_64.tar.gz",
|
||||
)},
|
||||
},
|
||||
Commands: map[string]*ice.Command{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {}},
|
||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {}},
|
||||
|
||||
ES: {Name: "es port=auto path=auto auto 启动:button 下载", Help: "搜索", Action: map[string]*ice.Action{
|
||||
"download": {Name: "download", Help: "下载", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(code.INSTALL, "download", m.Conf(ES, kit.Keys(kit.MDB_META, runtime.GOOS)))
|
||||
}},
|
||||
|
||||
"start": {Name: "start", Help: "启动", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Option("install", ".")
|
||||
name := path.Base(m.Conf(ES, kit.Keys(kit.MDB_META, runtime.GOOS)))
|
||||
name = strings.Join(strings.Split(name, "-")[:2], "-")
|
||||
m.Cmdy(code.INSTALL, "start", name, "bin/elasticsearch")
|
||||
}},
|
||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
name := path.Base(m.Conf(ES, kit.Keys(kit.MDB_META, runtime.GOOS)))
|
||||
name = strings.Join(strings.Split(name, "-")[:2], "-")
|
||||
m.Cmdy(code.INSTALL, name, arg)
|
||||
}},
|
||||
|
||||
"GET": {Name: "GET 查看:button cmd:text=/", Help: "命令", Action: map[string]*ice.Action{}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
if pod := m.Option("_pod"); pod != "" {
|
||||
m.Option("_pod", "")
|
||||
m.Cmdy(web.SPACE, pod, m.Prefix(cmd), arg)
|
||||
|
||||
if m.Result(0) != ice.ErrWarn || m.Result(1) != ice.ErrNotFound {
|
||||
return
|
||||
}
|
||||
m.Set(ice.MSG_RESULT)
|
||||
}
|
||||
|
||||
m.Option(web.SPIDE_HEADER, web.ContentType, web.ContentJSON)
|
||||
m.Echo(kit.Formats(kit.UnMarshal(m.Cmdx(web.SPIDE, web.SPIDE_DEV, web.SPIDE_RAW,
|
||||
web.SPIDE_GET, kit.MergeURL2(m.Conf(ES, "meta.address"), kit.Select("/", arg, 0))))))
|
||||
}},
|
||||
"CMD": {Name: "CMD 执行:button method:select=GET|PUT|POST|DELETE cmd:text=/ data:textarea", Help: "命令", Action: map[string]*ice.Action{}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
if pod := m.Option("_pod"); pod != "" {
|
||||
m.Option("_pod", "")
|
||||
m.Cmdy(web.SPACE, pod, m.Prefix(cmd), arg)
|
||||
|
||||
if m.Result(0) != ice.ErrWarn || m.Result(1) != ice.ErrNotFound {
|
||||
return
|
||||
}
|
||||
m.Set(ice.MSG_RESULT)
|
||||
}
|
||||
|
||||
m.Option(web.SPIDE_HEADER, web.ContentType, web.ContentJSON)
|
||||
prefix := []string{web.SPIDE, web.SPIDE_DEV, web.SPIDE_RAW, arg[0], kit.MergeURL2(m.Conf(ES, "meta.address"), arg[1])}
|
||||
|
||||
if len(arg) > 2 {
|
||||
prefix = append(prefix, web.SPIDE_DATA, arg[2])
|
||||
}
|
||||
m.Echo(kit.Formats(kit.UnMarshal(m.Cmdx(prefix))))
|
||||
}},
|
||||
},
|
||||
}
|
||||
|
||||
func init() { code.Index.Register(Index, nil) }
|
@ -1,37 +0,0 @@
|
||||
chapter "ElasticSearch"
|
||||
refer `
|
||||
官网 https://www.elastic.co/cn/elasticsearch/
|
||||
源码 https://github.com/elastic/elasticsearch
|
||||
文档 https://www.elastic.co/guide/index.html
|
||||
安装 https://www.elastic.co/guide/en/elasticsearch/reference/current/install-elasticsearch.html
|
||||
入门 https://www.cnblogs.com/sunsky303/p/9438737.html
|
||||
`
|
||||
|
||||
field "服务管理" web.code.es.es
|
||||
|
||||
section 下载
|
||||
refer `
|
||||
windows https://elasticsearch.thans.cn/downloads/elasticsearch/elasticsearch-7.3.2-windows-x86_64.zip
|
||||
darwin https://elasticsearch.thans.cn/downloads/elasticsearch/elasticsearch-7.3.2-darwin-x86_64.tar.gz
|
||||
linux https://elasticsearch.thans.cn/downloads/elasticsearch/elasticsearch-7.3.2-linux-x86_64.tar.gz
|
||||
`
|
||||
|
||||
section 启动
|
||||
spark shell `
|
||||
wget https://elasticsearch.thans.cn/downloads/elasticsearch/elasticsearch-7.3.2-linux-x86_64.tar.gz
|
||||
tar xvf elasticsearch-7.3.2-linux-x86_64.tar.gz && cd elasticsearch-7.3.2
|
||||
./bin/elasticsearch
|
||||
`
|
||||
|
||||
section 体验
|
||||
spark shell `
|
||||
curl http://localhost:9200
|
||||
`
|
||||
|
||||
field "查询数据" web.code.es.GET args `[ /index_test/test_type/1 ]` style command option `{ _pod centos.remote }`
|
||||
|
||||
field "提交数据" web.code.es.CMD args `[ POST /index_test/test_type/1 ] ` content `{
|
||||
"name": "lisi",
|
||||
"age" : "12"
|
||||
}` style command option `{ _pod centos.remote }`
|
||||
|
Loading…
x
Reference in New Issue
Block a user