imay commented on a change in pull request #1151: Add documentation for doris
on es
URL: https://github.com/apache/incubator-doris/pull/1151#discussion_r283311561
##########
File path: docs/documentation/cn/extending-doris/doris-on-es/doris-on-es.md
##########
@@ -0,0 +1,205 @@
+# Doris-On-ES使用手册
+
+Doris-On-ES将Doris的分布式查询规划能力和ES(Elasticsearch)的全文检索能力相结合,提供更完善的OLAP分析场景解决方案:
+
+ 1. ES中的多index分布式Join查询
+ 2. Doris和ES中的表联合查询,更复杂的全文检索过滤
+ 3. ES keyword类型字段的聚合查询:适用于index 频繁发生变化、单个分片文档数量千万级以上且该字段基数(cardinality)非常大
+
+本文档主要介绍该功能的实现原理、使用方式等。
+
+## 名词解释
+
+* FE:Frontend,Doris 的前端节点。负责元数据管理和请求接入。
+* BE:Backend,Doris 的后端节点。负责查询执行和数据存储。
+* Elasticsearch(ES):目前最流行的开源分布式搜索引擎。
+* DataNode:ES的数据存储与计算节点。
+* MasterNode:ES的Master节点,管理元数据、节点、数据分布等。
+* scroll:ES内置的数据集游标特性,用来对数据进行流式扫描和过滤。
+
+
+## 如何使用
+
+### 创建外表
+
+```
+CREATE EXTERNAL TABLE `es_table` (
+ `id` bigint(20) COMMENT "",
+ `k1` bigint(20) COMMENT "",
+ `k2` datetime COMMENT "",
+ `k3` varchar(20) COMMENT "",
+ `k4` varchar(100) COMMENT "",
+ `k5` float COMMENT ""
+) ENGINE=ELASTICSEARCH
+PARTITION BY RANGE(`id`)
+()
+PROPERTIES (
+"host" = "host",
+"user" = "xxxx",
+"password" = "xxxx",
+"index" = "tindex”,
+"type" = "doc"
+);
+```
+
+参数说明:
+
+参数 | 说明
+---|---
+host | ES集群连接地址,可指定一个或多个,Doris通过这个地址获取到ES版本号、index的shard分布信息
+user | 开启basic认证的ES集群的用户名,需要确保该用户有访问:
/、/\_cluster/state、/\_nodes/http等路径权限和对index的读权限
+password | 对应用户的密码信息
+index | Doris中的表对应的ES的index名字,可以是alias
+type | 指定index的type,默认是_doc
+transport | 内部保留,默认为http
+
+### 查询
+
+#### 基本条件过滤
+
+```
+select * from es_table where k1 > 1000 and k3 ='term' or k4 like 'fu*z_'
+```
+
+#### 扩展的esquery sql语法
+通过`esquery`函数将一些无法用sql表述的ES
query如match、geoshape等下推给ES进行过滤处理,`esquery`的第一个列名参数用于关联`index`,第二个参数是ES的基本`Query
DSL`的json表述,使用花括号`{}`包含,json的`root key`有且只能有一个,如match、geo_shape、bool等
+
+match查询:
+
+```
+select * from es_table where esquery('k4', '{
Review comment:
```suggestion
select * from es_table where esquery(k4, '{
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]