Skip to content

Commit

Permalink
Elasticsearch doc
Browse files Browse the repository at this point in the history
  • Loading branch information
araddon committed Nov 15, 2017
1 parent 9595269 commit f8378fd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
21 changes: 16 additions & 5 deletions backends/elasticsearch/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

MySQL access to Elasticsearch
--------------------------------
Elasticserch is awesome, but sometimes querying it, and integrating it into other apps it would be great to have mysql.
[Elasticsearch](https://www.elastic.co/) is awesome, but sometimes querying it is not, and integrating it into other apps involves custom code.
It would be great to have mysql and all the tools that talk MySql to be able to access it.

## Example Usage
This example imports a couple hours worth of historical data
Expand Down Expand Up @@ -31,8 +32,8 @@ show databases;
-- dataux will introspect the tables
-- to create schema for the tables
CREATE schema github_archive IF NOT EXISTS WITH {
"type":"elasticsearch",
"schema":"github_archive",
"type":"elasticsearch",
"schema":"github_archive",
"hosts": ["http://127.0.0.1:9200"]
};

Expand Down Expand Up @@ -66,8 +67,6 @@ WHERE repository.description LIKE "database";

```



SQL -> Elasticsearch
----------------------------------

Expand All @@ -81,4 +80,16 @@ filter: terms | `select * from table WHERE year IN (2015,2014,2013);`
filter: gte, range | `select * from table WHERE year BETWEEN 2012 AND 2014`


Configuration
-----------------------------
* *tables_to_load* If you do not want to load all tables.

```
CREATE schema github_archive IF NOT EXISTS WITH {
"type":"elasticsearch",
"schema":"github_archive",
"tables_to_load":["indexa","indexb"],
"hosts": ["http://127.0.0.1:9200"]
};
```
10 changes: 2 additions & 8 deletions backends/elasticsearch/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,11 @@ func (m *Source) Setup(ss *schema.Schema) error {
m.tablemap = make(map[string]*schema.Table)

if ss.Conf != nil && len(ss.Conf.Partitions) > 0 {
// ??
// not yet implemented. Do we need to on es? probably
// not as we don't plan on poly-filling.
}

u.Debugf("Init() Eleasticsearch schema P=%p", m.schema)
if err := m.findEsNodes(); err != nil {
u.Errorf("could not init es: %v", err)
return err
}

if err := m.loadTableNames(); err != nil {
u.Errorf("could not load es tables: %v", err)
return err
Expand All @@ -68,8 +64,6 @@ func (m *Source) Setup(ss *schema.Schema) error {
return nil
}

func (m *Source) findEsNodes() error { return nil }

// Open open connection to elasticsearch source.
func (m *Source) Open(schemaName string) (schema.Conn, error) {
//u.Debugf("Open(%v)", schemaName)
Expand Down

0 comments on commit f8378fd

Please sign in to comment.