File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ## Overview
2+
3+ Query OpenSearch databases using DSL. This plugin is primarily a wrapper around the ` _search ` API endpoint that allows for a range of queries.
4+
5+ See the [ OpenSearch API docs] ( https://docs.opensearch.org/latest/api-reference/search-apis/search/ ) for more information.
6+
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " indices" ,
3+ "displayName" : " Indices" ,
4+ "baseDataSourceName" : " httpRequestUnscoped" ,
5+ "config" : {
6+ "httpMethod" : " get" ,
7+ "pagingConfig_mode" : " none" ,
8+ "pagingConfig_offset_base" : 1 ,
9+ "expandInnerObjects" : true ,
10+ "endpointPath" : " _cat/indices" ,
11+ "pathToData" : " " ,
12+ "getArgs" : [],
13+ "headers" : []
14+ },
15+ "timeframes" : false ,
16+ "matches" : " none" ,
17+ "visibility" : {
18+ "type" : " hidden"
19+ },
20+ "metadata" : [
21+ {
22+ "name" : " index" ,
23+ "shape" : " string" ,
24+ "displayName" : " Index" ,
25+ "role" : " value"
26+ }
27+ ]
28+ }
Original file line number Diff line number Diff line change 1+ if ( data . aggregations && Object . keys ( data . aggregations ) . length > 0 ) {
2+
3+ const agg = data . aggregations [ Object . keys ( data . aggregations ) . at ( - 1 ) ] ; // last aggregation to support pipelining
4+
5+ if ( agg . buckets ) {
6+
7+ result = agg . buckets ;
8+
9+ } else if ( agg . values ) {
10+
11+ result = [ agg . values ] ;
12+
13+ } else if ( agg . value ) {
14+
15+ result = [ {
16+ value : agg . value
17+ } ] ;
18+
19+ } else {
20+
21+ result = [ agg ] ;
22+
23+ }
24+
25+ } else {
26+
27+ result = data . hits . hits . map ( hit => hit . _source ) ;
28+
29+ }
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " search" ,
3+ "displayName" : " Search" ,
4+ "baseDataSourceName" : " httpRequestUnscoped" ,
5+ "matches" : " none" ,
6+ "manualConfigApply" : true ,
7+ "config" : {
8+ "httpMethod" : " post" ,
9+ "pagingConfig_mode" : " none" ,
10+ "pagingConfig_offset_base" : 1 ,
11+ "expandInnerObjects" : true ,
12+ "endpointPath" : " {{index}}/_search" ,
13+ "postRequestScript" : " search.js" ,
14+ "getArgs" : [],
15+ "headers" : [],
16+ "postBody" : " {{query}}"
17+ },
18+ "ui" : [
19+ {
20+ "name" : " index" ,
21+ "type" : " autocomplete" ,
22+ "label" : " Index" ,
23+ "validation" : {
24+ "required" : true
25+ },
26+ "placeholder" : " Select index" ,
27+ "isMulti" : false ,
28+ "allowCustomValues" : true ,
29+ "data" : {
30+ "source" : " dataStream" ,
31+ "dataStreamName" : " indices"
32+ }
33+ },
34+ {
35+ "name" : " query" ,
36+ "type" : " json" ,
37+ "defaultValue" : {
38+ "size" : 100
39+ },
40+ "label" : " Query body" ,
41+ "help" : " The Query DSL JSON. See [OpenSearch API docs](https://docs.opensearch.org/latest/api-reference/search-apis/search/#request-body)." ,
42+ "validation" : {
43+ "required" : true
44+ }
45+ }
46+ ],
47+ "supportsNoneTimeframe" : true ,
48+ "requiresParameterTimeframe" : true ,
49+ "defaultTimeframe" : " none"
50+ }
Original file line number Diff line number Diff line change 1+ # Configuration
2+
3+ ## Instance URL
4+
5+ The base URL of your OpenSearch database.
6+
7+ For example:
8+ ` https://<your-opensearch-host>:9200 `
9+
10+ Do * not* include the ` /api ` path.
11+
12+ ## Authentication
13+
14+ The data source supports basic (username and password) or anonymous authentication.
15+
16+ If using basic authentication, ensure the user only has read permissions.
17+
18+ If using anonymous, ensure the endpoint is secured in some other form.
19+
20+ If you need to whitelist the IP addresses for SquaredUp these can be found on the [ Data Security] ( https://docs.squaredup.com/reference/security/data-security ) KB article.
21+
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " open-search" ,
3+ "displayName" : " OpenSearch" ,
4+ "version" : " 1.0.3" ,
5+ "author" : {
6+ "name" : " SquaredUp Labs" ,
7+ "type" : " labs"
8+ },
9+ "description" : " Query OpenSearch databases using DSL." ,
10+ "category" : " Database" ,
11+ "type" : " cloud" ,
12+ "restrictedToPlatforms" : [],
13+ "importNotSupported" : true ,
14+ "schemaVersion" : " 2.0" ,
15+ "base" : {
16+ "plugin" : " WebAPI" ,
17+ "majorVersion" : " 1" ,
18+ "config" : {
19+ "authMode" : " {{authMode}}" ,
20+ "basicAuthUsername" : " {{basicAuthUsername}}" ,
21+ "basicAuthPassword" : " {{basicAuthPassword}}" ,
22+ "queryArgs" : [],
23+ "headers" : [
24+ {
25+ "key" : " Content-Type" ,
26+ "value" : " application/json"
27+ }
28+ ],
29+ "baseUrl" : " {{instanceUrl}}" ,
30+ "ignoreCertificateErrors" : " {{ignoreCertificateErrors}}"
31+ }
32+ },
33+ "links" : [
34+ {
35+ "category" : " documentation" ,
36+ "url" : " https://github.com/squaredup/plugins/blob/main/plugins/OpenSearch/v1/docs/setup.md" ,
37+ "label" : " Help adding this plugin"
38+ },
39+ {
40+ "category" : " source" ,
41+ "url" : " https://github.com/squaredup/plugins/tree/main/plugins/OpenSearch/v1" ,
42+ "label" : " Repository"
43+ }
44+ ]
45+ }
Original file line number Diff line number Diff line change 1+ [
2+ {
3+ "type" : " text" ,
4+ "name" : " instanceUrl" ,
5+ "label" : " Instance URL" ,
6+ "validation" : { "required" : true },
7+ "placeholder" : " Enter the OpenSearch URL"
8+ },
9+ {
10+ "name" : " authMode" ,
11+ "type" : " radio" ,
12+ "label" : " Authentication" ,
13+ "help" : " **Basic:** Authenticate with username and password. \n **Anonymous access:** No authentication required" ,
14+ "defaultValue" : " basic" ,
15+ "validation" : {
16+ "required" : true
17+ },
18+ "options" : [
19+ {
20+ "label" : " Basic" ,
21+ "value" : " basic"
22+ },
23+ {
24+ "label" : " Anonymous access" ,
25+ "value" : " none"
26+ }
27+
28+ ]
29+ },
30+ {
31+ "type" : " fieldGroup" ,
32+ "visible" : {
33+ "authMode" : " basic"
34+ },
35+ "fields" : [
36+ {
37+ "type" : " text" ,
38+ "name" : " basicAuthUsername" ,
39+ "label" : " Username" ,
40+ "validation" : { "required" : true },
41+ "placeholder" : " Enter a username"
42+ },
43+ {
44+ "type" : " password" ,
45+ "name" : " basicAuthPassword" ,
46+ "label" : " Password" ,
47+ "validation" : { "required" : true },
48+ "placeholder" : " Enter a password"
49+ }
50+ ]
51+ },
52+ {
53+ "type" : " checkbox" ,
54+ "name" : " ignoreCertificateErrors" ,
55+ "label" : " Ignore certificate errors" ,
56+ "help" : " Ignore certificate errors when connecting to an OpenSearch instance with a self-signed certificate"
57+ }
58+ ]
You can’t perform that action at this time.
0 commit comments