|
| 1 | +h3 Elasticsearch Data Source |
| 2 | + |
| 3 | +p The Elasticsearch Data Source is a thin wrapper around the Elasticsearch API, making it easier to submit searches and process the results. For more fine-tuned control around the requests, it may be preferable to use the JSON Data Source instead. |
| 4 | + |
| 5 | +P Please note that it may be necessary to set the optional |
| 6 | + em proxy |
| 7 | + | property in the Data Source in order to access web sites or services in other domains. |
| 8 | + | This property lists other Cyclotron servers which may have the required connectivity. |
| 9 | + | By default, this Data Source uses the current Cyclotron environment to proxy the request. |
| 10 | + |
| 11 | +p Examples of the Elasticsearch Data Source are available on the |
| 12 | + a(href='/example-datasource-elasticsearch') example-datasource-elasticsearch |
| 13 | + | dashboard |
| 14 | + |
| 15 | +property-table(properties='config.dashboard.properties.dataSources.options.elasticsearch.properties') |
| 16 | + |
| 17 | +h4 API Name |
| 18 | + |
| 19 | +p The |
| 20 | + em method |
| 21 | + | property (displayed as API Name) controls which Elasticsearch endpoint to submit the request to. By default this is "_search", but it can by changed to any valid endpoint (e.g. "_msearch", "_suggest"). |
| 22 | + |
| 23 | +h4 Response Adapter |
| 24 | + |
| 25 | +p The |
| 26 | + em responseAdapter |
| 27 | + | property controls how Cyclotron handles the result that Elasticsearch provides. The default value, |
| 28 | + em "auto" |
| 29 | + | , automatically selects between |
| 30 | + em "hits" |
| 31 | + | and |
| 32 | + em "aggregations" |
| 33 | + | by choosing |
| 34 | + em "aggregations" |
| 35 | + | when the response includes aggregations, otherwise |
| 36 | + em "hits |
| 37 | + | . Both |
| 38 | + em "hits" |
| 39 | + | and |
| 40 | + em "aggregations" |
| 41 | + | can be selected manually as well. If a Elasticsearch request returns both hits and aggregations, custom processing will be needed to consume both at once. This is possible using the |
| 42 | + em "raw" |
| 43 | + | option, which returns the original response. In this case, the |
| 44 | + em postProcessor |
| 45 | + | option should be set to a JavaScript function that can handle the entire result. |
| 46 | + |
| 47 | + |
| 48 | +h4 Pre-Processor |
| 49 | + |
| 50 | +p The Elasticsearch Data Source supports an optional pre-processor function that will be called before |
| 51 | + | the Data Source executes. For more details, see the main Data Sources page. |
| 52 | + |
| 53 | +h4 Post-Processor |
| 54 | + |
| 55 | +p The Elasticsearch Data Source supports an optional post-processor function that will be called after |
| 56 | + | data is loaded. For more details, see the main Data Sources page. |
| 57 | + |
| 58 | +p The data that is sent to the Post-Processor will depend on the setting of the |
| 59 | + em responseAdapter |
| 60 | + | property. This property controls how the Elasticsearch response is converted into Cyclotron's tabular data format. The Post-Processor receives the output of whichever |
| 61 | + em responseAdapter |
| 62 | + | has been selected. In order to manually inspect the entire response, set |
| 63 | + em responseAdapter |
| 64 | + | to "raw". |
0 commit comments