Elasticsearch Data Format Plugin provides a feature to allow you to download a response of a search result as several formats other than JSON. The supported formats are CSV, Excel and JSON(Bulk).
Version | Tested on ES |
---|---|
master | 5.3.x |
5.3.0 | 5.3.0 |
5.2.1 | 5.2.1 |
5.0.0 | 5.0.2 |
2.4.0 | 2.4.0 |
2.3.0 | 2.3.1 |
2.2.0 | 2.2.0 |
2.1.1 | 2.1.1 |
1.6.0 | 1.6.0 |
1.5.0 | 1.5.0 |
1.4.1 | 1.4.2 |
1.3.1 | 1.3.2 |
1.2.0 | 1.2.4 |
0.1.0 | 0.90.7 |
Please file an issue. (Japanese forum is here.)
$ $ES_HOME/bin/elasticsearch-plugin install org.codelibs:elasticsearch-dataformat:5.3.0
$ $ES_HOME/bin/plugin install org.codelibs/elasticsearch-dataformat/2.4.0
This plugin allows you to download data as a format you want. If the query dsl contains "from" parameter, the query is processed as search query. If not, it's as scan query(all data are stored.).
$ curl -o /tmp/data.csv -XGET "localhost:9200/{index}/{type}/_data?format=csv&source=..."
Request Parameter | Type | Description |
---|---|---|
append.header | boolean | Append column headers if true |
fields_name | string | choose the fields to dump |
source | string | Query DSL |
csv.separator | string | Separate character in CSV |
csv.quote | string | Quote character in CSV |
csv.escape | string | Escape character in CSV |
csv.nullString | string | String if a value is null |
csv.encoding | string | Encoding for CSV |
$ curl -o /tmp/data.xls -XGET "localhost:9200/{index}/{type}/_data?format=xls&source=..."
Request Parameter | Type | Description |
---|---|---|
append.header | boolean | Append column headers if true |
fields_name | string | choose the fields to dump |
source | string | Query DSL |
$ curl -o /tmp/data.xlsx -XGET "localhost:9200/{index}/{type}/_data?format=xlsx&source=..."
Request Parameter | Type | Description |
---|---|---|
source | string | Query DSL |
$ curl -o /tmp/data.json -XGET "localhost:9200/{index}/{type}/_data?format=json&source=..."
Request Parameter | Type | Description |
---|---|---|
source | string | Query DSL |
bulk.index | string | Index name in Bulk file |
bulk.type | string | Type name in Bulk file |