实测:NLPchina/elasticsearch-sql

2021-08-10 10:38:04 浏览数 (1)

1、安装elasticsearch-sql插件

(1)安装elasticsearch-sql插件

代码语言:javascript复制
D:appelasticsearch-7.12.0>binelasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/7.12.0.0/elasticsearch-sql-7.12.0.0.zip
"warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME"
-> Installing https://github.com/NLPchina/elasticsearch-sql/releases/download/7.12.0.0/elasticsearch-sql-7.12.0.0.zip
-> Downloading https://github.com/NLPchina/elasticsearch-sql/releases/download/7.12.0.0/elasticsearch-sql-7.12.0.0.zip
[=================================================] 100%??
-> Installed sql
-> Please restart Elasticsearch to activate any plugins installed

D:appelasticsearch-7.12.0>

(2)启动elasticsearch

代码语言:javascript复制
D:appelasticsearch-7.12.0>binelasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/7.12.0.0/elasticsearch-sql-7.12.0.0.zip
"warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME"
-> Installing https://github.com/NLPchina/elasticsearch-sql/releases/download/7.12.0.0/elasticsearch-sql-7.12.0.0.zip
-> Downloading https://github.com/NLPchina/elasticsearch-sql/releases/download/7.12.0.0/elasticsearch-sql-7.12.0.0.zip
[=================================================] 100%??
-> Installed sql
-> Please restart Elasticsearch to activate any plugins installed

D:appelasticsearch-7.12.0>binelasticsearch
"warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME"
Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Unable to get Charset 'cp65001' for property 'sun.stdout.encoding', using default UTF-8 and continuing.
[2021-08-09T16:29:32,395][INFO ][o.e.n.Node               ] [TPA-VDI-OA11-17] version[7.12.0], pid[12244], build[default/zip/78722783c38caa25a70982b5b042074cde5d3b3a/2021-03-18T06:17:15.410153305Z], OS[Windows 10/10.0/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/11.0.3/11.0.3 12-LTS]
[2021-08-09T16:29:32,403][INFO ][o.e.n.Node               ] [TPA-VDI-OA11-17] JVM home [C:Program FilesJavajdk-11.0.3], using bundled JDK [false]
[2021-08-09T16:29:32,405][INFO ][o.e.n.Node               ] [TPA-VDI-OA11-17] JVM arguments [-Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX: AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.locale.providers=SPI,COMPAT, --add-opens=java.base/java.io=ALL-UNNAMED, -XX: UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX: UseCMSInitiatingOccupancyOnly, -Djava.io.tmpdir=D:UserschengyqAppDataLocalTempelasticsearch, -XX: HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Xms1024m, -Xmx1024m, -XX:MaxDirectMemorySize=536870912, -Delasticsearch, -Des.path.home=D:appelasticsearch-7.12.0, -Des.path.conf=D:appelasticsearch-7.12.0config, -Des.distribution.flavor=default, -Des.distribution.type=zip, -Des.bundled_jdk=true]
[2021-08-09T16:29:37,674][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [aggs-matrix-stats]
[2021-08-09T16:29:37,676][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [analysis-common]
[2021-08-09T16:29:37,681][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [constant-keyword]
[2021-08-09T16:29:37,682][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [flattened]
[2021-08-09T16:29:37,683][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [frozen-indices]
[2021-08-09T16:29:37,684][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [ingest-common]
[2021-08-09T16:29:37,684][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [ingest-geoip]
[2021-08-09T16:29:37,685][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [ingest-user-agent]
[2021-08-09T16:29:37,686][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [kibana]
[2021-08-09T16:29:37,687][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [lang-expression]
[2021-08-09T16:29:37,687][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [lang-mustache]
[2021-08-09T16:29:37,688][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [lang-painless]
[2021-08-09T16:29:37,689][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [mapper-extras]
[2021-08-09T16:29:37,695][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [mapper-version]
[2021-08-09T16:29:37,696][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [parent-join]
[2021-08-09T16:29:37,697][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [percolator]
[2021-08-09T16:29:37,698][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [rank-eval]
[2021-08-09T16:29:37,698][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [reindex]
[2021-08-09T16:29:37,699][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [repositories-metering-api]
[2021-08-09T16:29:37,700][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [repository-encrypted]
[2021-08-09T16:29:37,701][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [repository-url]
[2021-08-09T16:29:37,702][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [search-business-rules]
[2021-08-09T16:29:37,703][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [searchable-snapshots]
[2021-08-09T16:29:37,708][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [snapshot-repo-test-kit]
[2021-08-09T16:29:37,709][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [spatial]
[2021-08-09T16:29:37,710][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [transform]
[2021-08-09T16:29:37,712][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [transport-netty4]
[2021-08-09T16:29:37,713][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [unsigned-long]
[2021-08-09T16:29:37,713][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [vectors]
[2021-08-09T16:29:37,714][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [wildcard]
[2021-08-09T16:29:37,715][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-aggregate-metric]
[2021-08-09T16:29:37,716][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-analytics]
[2021-08-09T16:29:37,722][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-async]
[2021-08-09T16:29:37,723][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-async-search]
[2021-08-09T16:29:37,724][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-autoscaling]
[2021-08-09T16:29:37,725][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-ccr]
[2021-08-09T16:29:37,728][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-core]
[2021-08-09T16:29:37,728][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-data-streams]
[2021-08-09T16:29:37,733][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-deprecation]
[2021-08-09T16:29:37,734][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-enrich]
[2021-08-09T16:29:37,737][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-eql]
[2021-08-09T16:29:37,738][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-fleet]
[2021-08-09T16:29:37,745][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-graph]
[2021-08-09T16:29:37,748][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-identity-provider]
[2021-08-09T16:29:37,749][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-ilm]
[2021-08-09T16:29:37,749][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-ingest]
[2021-08-09T16:29:37,751][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-logstash]
[2021-08-09T16:29:37,752][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-ml]
[2021-08-09T16:29:37,754][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-monitoring]
[2021-08-09T16:29:37,754][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-ql]
[2021-08-09T16:29:37,760][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-rollup]
[2021-08-09T16:29:37,763][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-runtime-fields]
[2021-08-09T16:29:37,764][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-security]
[2021-08-09T16:29:37,765][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-sql]
[2021-08-09T16:29:37,770][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-stack]
[2021-08-09T16:29:37,776][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-text-structure]
[2021-08-09T16:29:37,776][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-voting-only-node]
[2021-08-09T16:29:37,777][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded module [x-pack-watcher]
[2021-08-09T16:29:37,778][INFO ][o.e.p.PluginsService     ] [TPA-VDI-OA11-17] loaded plugin [sql]
[2021-08-09T16:29:38,878][INFO ][o.e.e.NodeEnvironment    ] [TPA-VDI-OA11-17] using [1] data paths, mounts [[Data (D:)]], net usable_space [95.3gb], net total_space [199.9gb], types [NTFS]
[2021-08-09T16:29:38,880][INFO ][o.e.e.NodeEnvironment    ] [TPA-VDI-OA11-17] heap size [990.7mb], compressed ordinary object pointers [true]
[2021-08-09T16:29:39,001][INFO ][o.e.n.Node               ] [TPA-VDI-OA11-17] node name [TPA-VDI-OA11-17], node ID [31x-7zHgTPG_kJ7DQWDGVg], cluster name [elasticsearch], roles [transform, data_frozen, master, remote_cluster_client, data, ml, data_content, data_hot, data_warm, data_cold, ingest]
[2021-08-09T16:29:46,091][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [TPA-VDI-OA11-17] [controller/9336] [Main.cc@117] controller (64 bit): Version 7.12.0 (Build 778cc7261dfdd1) Copyright (c) 2021 Elasticsearch BV
[2021-08-09T16:29:46,755][INFO ][o.e.x.s.a.s.FileRolesStore] [TPA-VDI-OA11-17] parsed [0] roles from file [D:appelasticsearch-7.12.0configroles.yml]
[2021-08-09T16:29:49,321][INFO ][o.e.t.NettyAllocator     ] [TPA-VDI-OA11-17] creating NettyAllocator with the following configs: [name=unpooled, suggested_max_allocation_size=1mb, factors={es.unsafe.use_unpooled_allocator=null, g1gc_enabled=false, g1gc_region_size=0b, heap_size=990.7mb}]
[2021-08-09T16:29:49,449][INFO ][o.e.d.DiscoveryModule    ] [TPA-VDI-OA11-17] using discovery type [zen] and seed hosts providers [settings]
[2021-08-09T16:29:50,238][INFO ][o.e.g.DanglingIndicesState] [TPA-VDI-OA11-17] gateway.auto_import_dangling_indices is disabled, dangling indices will not be automatically detected or imported and must be managed manually
[2021-08-09T16:29:51,030][INFO ][o.e.n.Node               ] [TPA-VDI-OA11-17] initialized
[2021-08-09T16:29:51,031][INFO ][o.e.n.Node               ] [TPA-VDI-OA11-17] starting ...
[2021-08-09T16:29:51,073][INFO ][o.e.x.s.c.PersistentCache] [TPA-VDI-OA11-17] persistent cache index loaded
[2021-08-09T16:29:51,494][INFO ][o.e.t.TransportService   ] [TPA-VDI-OA11-17] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}, {[::1]:9300}
[2021-08-09T16:29:51,964][WARN ][o.e.b.BootstrapChecks    ] [TPA-VDI-OA11-17] the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
[2021-08-09T16:29:51,966][INFO ][o.e.c.c.Coordinator      ] [TPA-VDI-OA11-17] cluster UUID [xP6UaBjkTeCtah8_WO5RbQ]
[2021-08-09T16:29:51,987][INFO ][o.e.c.c.ClusterBootstrapService] [TPA-VDI-OA11-17] no discovery configuration found, will perform best-effort cluster bootstrapping after [3s] unless existing master is discovered
[2021-08-09T16:29:52,189][INFO ][o.e.c.s.MasterService    ] [TPA-VDI-OA11-17] elected-as-master ([1] nodes joined)[{TPA-VDI-OA11-17}{31x-7zHgTPG_kJ7DQWDGVg}{jCe6oELgReChSpDLcSwTYQ}{127.0.0.1}{127.0.0.1:9300}{cdfhilmrstw}{ml.machine_memory=12884430848, xpack.installed=true, transform.node=true, ml.max_open_jobs=20, ml.max_jvm_size=1038876672} elect leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 2, version: 37, delta: master node changed {previous [], current [{TPA-VDI-OA11-17}{31x-7zHgTPG_kJ7DQWDGVg}{jCe6oELgReChSpDLcSwTYQ}{127.0.0.1}{127.0.0.1:9300}{cdfhilmrstw}{ml.machine_memory=12884430848, xpack.installed=true, transform.node=true, ml.max_open_jobs=20, ml.max_jvm_size=1038876672}]}
[2021-08-09T16:29:52,455][INFO ][o.e.c.s.ClusterApplierService] [TPA-VDI-OA11-17] master node changed {previous [], current [{TPA-VDI-OA11-17}{31x-7zHgTPG_kJ7DQWDGVg}{jCe6oELgReChSpDLcSwTYQ}{127.0.0.1}{127.0.0.1:9300}{cdfhilmrstw}{ml.machine_memory=12884430848, xpack.installed=true, transform.node=true, ml.max_open_jobs=20, ml.max_jvm_size=1038876672}]}, term: 2, version: 37, reason: Publication{term=2, version=37}
[2021-08-09T16:29:52,849][INFO ][o.e.h.AbstractHttpServerTransport] [TPA-VDI-OA11-17] publish_address {127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}, {[::1]:9200}
[2021-08-09T16:29:52,849][INFO ][o.e.n.Node               ] [TPA-VDI-OA11-17] started
[2021-08-09T16:29:53,052][INFO ][o.e.l.LicenseService     ] [TPA-VDI-OA11-17] license [267a1720-5d10-42f0-b8db-66ea642485f0] mode [basic] - valid
[2021-08-09T16:29:53,055][INFO ][o.e.x.s.s.SecurityStatusChangeListener] [TPA-VDI-OA11-17] Active license is now [BASIC]; Security is disabled
[2021-08-09T16:29:53,068][INFO ][o.e.g.GatewayService     ] [TPA-VDI-OA11-17] recovered [0] indices into cluster_state
[2021-08-09T16:57:16,122][INFO ][o.e.n.Node               ] [TPA-VDI-OA11-17] stopping ...
[2021-08-09T16:57:16,132][INFO ][o.e.x.w.WatcherService   ] [TPA-VDI-OA11-17] stopping watch service, reason [shutdown initiated]
[2021-08-09T16:57:16,139][INFO ][o.e.x.w.WatcherLifeCycleService] [TPA-VDI-OA11-17] watcher has stopped and shutdown
[2021-08-09T16:57:16,162][INFO ][o.e.x.m.p.NativeController] [TPA-VDI-OA11-17] Native controller process has stopped - no new native processes can be started

可以看到loaded plugin [sql]插件已经启动。

2、导入测试数据

代码语言:javascript复制
POST /blog/_bulk?refresh
{ "index": { "_id": "1" }}
{ "title": "VMware安装" ,"author":"程裕强","content":"VMware Workstation虚拟机软件安装图解" , "url":"http://x.co/6nc81","postdate":"2018-12-11"}
{ "index": {"_id": "2" }}
{ "title":  "Linux安装" ,"author":  "程裕强" ,"content": "VMware模拟Linux服务器安装图解" , "url": "http://x.co/6nc82","postdate":"2018-12-12"}
{ "index": { "_id": "3" }}
{ "title":  "Xshell6安装" , "author": "程裕强" ,"content": "Xshell6个人版安装与远程操作连接服务器..." , "url": "http://x.co/6nc84" ,"postdate":"2018-12-13"}
{ "index": {"_id": "4" }}
{ "title": "CentOS 7.x基本设置" ,"author":"程裕强","content":"CentOS 7.x基本设置","url":"http://x.co/6nc85" ,"postdate":"2018-12-15"}
{ "create": {"_id": "5" }}
{ "title": "JDK安装与配置","author":"程裕强" ,"content": "图解JDK安装配置" , "url": "http://x.co/6nc86","postdate":"2018-12-15"}
{ "create": {"_id": "6" }}
{ "title": "Intellij IDEA安装","author":"程裕强" ,"content": "图解Windows平台下Intellij IDEA安装配置" , "url": "http://x.co/6nc89","postdate":"2019-01-03"}
代码语言:javascript复制
GET blog/_search
代码语言:javascript复制

3、安装谷歌浏览器的elasticsearch-sql-site-chrome插件

(1)下载插件:https://github.com/shi-yuan/elasticsearch-sql-site-chrome

(2)解压

(3)在chrome浏览器输入:chrome://extensions/ 先打开开发者模式,然后出现“加载已解压的扩展程序”按钮,单击该按钮,加载刚才已解压的扩展程序

(4)开打插件

(5)执行SQL命令 (首先在右上角填写对应的ES集群地址,此处填写了本地地址:http://127.0.0.1:9200/)

0 人点赞