Skip to content

Conversation

@wuyunfeng
Copy link
Member

@wuyunfeng wuyunfeng commented Jun 18, 2020

More information can be found: #3901

The created ES external Table must contains _id column if you want to fetch the Elasticsearch document _id.

CREATE EXTERNAL TABLE `doe_id2` (
  `_id` varchar COMMENT "",
   `city`  varchar COMMENT ""
) ENGINE=ELASTICSEARCH
PROPERTIES (
"hosts" = "http://127.0.0.1:8200",
"user" = "root",
"password" = "root",
"index" = "doe",
"type" = "doc",
"version" = "6.5.3",
"enable_docvalue_scan" = "true",
"transport" = "http"
);

Query:

mysql> select * from doe_id2 limit 10;
+----------------------+------+
| _id | city |
+----------------------+------+
| iRHNc3IB8XwmcbhB7lEB | gz |
| jBHNc3IB8XwmcbhB71Ef | gz |
| jRHNc3IB8XwmcbhB71GI | gz |
| jhHNc3IB8XwmcbhB71Hx | gz |
| ThHNc3IB8XwmcbhBkFHB | sh |
| TxHNc3IB8XwmcbhBkFH9 | sh |
| URHNc3IB8XwmcbhBklFA | sh |
| ahHNc3IB8XwmcbhBxlFq | gz |
| axHNc3IB8XwmcbhBxlHw | gz |
| bxHNc3IB8XwmcbhByVFO | gz |
+----------------------+------+


NOTICE:
This change the column name format to support column name start with "_".

@wuyunfeng wuyunfeng changed the title [Doris On ES] Support fetch field from ES [Doris On ES] Support fetch _id field from ES Jun 18, 2020
@wuyunfeng wuyunfeng changed the title [Doris On ES] Support fetch _id field from ES [Doris On ES] Support fetch _id field from ES Jun 18, 2020
@morningman morningman added api-review Categorizes an issue or PR as actively needing an API review. area/doris-on-es Issues or PRs related to Doris on ElasticSearch kind/improvement labels Jun 18, 2020
@wuyunfeng wuyunfeng requested a review from morningman June 18, 2020 04:23
Copy link
Contributor

@morningman morningman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@morningman morningman added the approved Indicates a PR has been approved by one committer. label Jun 18, 2020
@morningman morningman merged commit 355df12 into apache:master Jun 19, 2020
@wuyunfeng wuyunfeng deleted the feature-support-id branch June 19, 2020 09:32
morningman pushed a commit to morningman/doris that referenced this pull request Jun 22, 2020
More information can be found: apache#3901

The created ES external Table must contains `_id` column if you want to fetch the Elasticsearch document `_id`.
```
CREATE EXTERNAL TABLE `doe_id2` (
  `_id` varchar COMMENT "",
   `city`  varchar COMMENT ""
) ENGINE=ELASTICSEARCH
PROPERTIES (
"hosts" = "http://10.74.167.16:8200",
"user" = "root",
"password" = "root",
"index" = "doe",
"type" = "doc",
"version" = "6.5.3",
"enable_docvalue_scan" = "true",
"transport" = "http"
);

Query:

```
mysql> select * from doe_id2 limit 10;
+----------------------+------+
| _id                  | city |
+----------------------+------+
| iRHNc3IB8XwmcbhB7lEB | gz   |
| jBHNc3IB8XwmcbhB71Ef | gz   |
| jRHNc3IB8XwmcbhB71GI | gz   |
| jhHNc3IB8XwmcbhB71Hx | gz   |
| ThHNc3IB8XwmcbhBkFHB | sh   |
| TxHNc3IB8XwmcbhBkFH9 | sh   |
| URHNc3IB8XwmcbhBklFA | sh   |
| ahHNc3IB8XwmcbhBxlFq | gz   |
| axHNc3IB8XwmcbhBxlHw | gz   |
| bxHNc3IB8XwmcbhByVFO | gz   |
+----------------------+------+
```

NOTICE:
This change the column name format to support column name start with "_".
@EmmyMiao87 EmmyMiao87 mentioned this pull request Aug 18, 2020
suxiaogang223 pushed a commit to suxiaogang223/doris that referenced this pull request Jul 15, 2025
Hastyshell pushed a commit to Hastyshell/doris that referenced this pull request Jul 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-review Categorizes an issue or PR as actively needing an API review. approved Indicates a PR has been approved by one committer. area/doris-on-es Issues or PRs related to Doris on ElasticSearch kind/improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants