-
Notifications
You must be signed in to change notification settings - Fork 0
OpenSearch plugin - initial commit #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
291b28e
1fe09dc
c60b132
9fb7911
b9cd25c
e080067
2efb9c2
303e981
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| ## Overview | ||
|
|
||
| Query OpenSearch databases using DSL. This plugin is primarily a wrapper around the `_search` API endpoint that allows for a range of queries. | ||
|
|
||
| See the [OpenSearch API docs](https://docs.opensearch.org/latest/api-reference/search-apis/search/) for more information. | ||
|
|
||
|
Comment on lines
+1
to
+6
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| { | ||
| "name": "indices", | ||
| "displayName": "Indices", | ||
| "baseDataSourceName": "httpRequestUnscoped", | ||
| "config": { | ||
| "httpMethod": "get", | ||
| "pagingConfig_mode": "none", | ||
| "pagingConfig_offset_base": 1, | ||
| "expandInnerObjects": true, | ||
| "endpointPath": "_cat/indices", | ||
richbenwell marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "pathToData": "", | ||
| "getArgs": [], | ||
| "headers": [] | ||
richbenwell marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| "timeframes": false, | ||
| "matches": "none", | ||
| "visibility": { | ||
| "type": "hidden" | ||
| }, | ||
| "metadata": [ | ||
| { | ||
| "name": "index", | ||
| "shape": "string", | ||
| "displayName": "Index", | ||
| "role": "value" | ||
| } | ||
| ] | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,29 @@ | ||||||||||||||
| if (data.aggregations && Object.keys(data.aggregations).length > 0) { | ||||||||||||||
|
|
||||||||||||||
| const agg = data.aggregations[Object.keys(data.aggregations).at(-1)]; // last aggregation to support pipelining | ||||||||||||||
|
|
||||||||||||||
| if(agg.buckets) { | ||||||||||||||
|
|
||||||||||||||
| result = agg.buckets; | ||||||||||||||
|
|
||||||||||||||
| } else if (agg.values) { | ||||||||||||||
|
|
||||||||||||||
| result = [agg.values]; | ||||||||||||||
|
|
||||||||||||||
| } else if (agg.value) { | ||||||||||||||
|
|
||||||||||||||
| result = [{ | ||||||||||||||
| value: agg.value | ||||||||||||||
| }]; | ||||||||||||||
|
|
||||||||||||||
| } else { | ||||||||||||||
|
|
||||||||||||||
| result = [agg]; | ||||||||||||||
|
|
||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| } else { | ||||||||||||||
|
|
||||||||||||||
| result = data.hits.hits.map(hit => hit._source); | ||||||||||||||
|
|
||||||||||||||
|
Comment on lines
+27
to
+28
|
||||||||||||||
| result = data.hits.hits.map(hit => hit._source); | |
| const hits = data && data.hits && Array.isArray(data.hits.hits) ? data.hits.hits : []; | |
| result = hits | |
| .filter(hit => hit && Object.prototype.hasOwnProperty.call(hit, '_source')) | |
| .map(hit => hit._source); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| { | ||
| "name": "search", | ||
| "displayName": "Search", | ||
|
Comment on lines
+2
to
+3
|
||
| "baseDataSourceName": "httpRequestUnscoped", | ||
|
Comment on lines
+2
to
+4
|
||
| "matches": "none", | ||
| "manualConfigApply": true, | ||
| "config": { | ||
| "httpMethod": "post", | ||
| "pagingConfig_mode": "none", | ||
| "pagingConfig_offset_base": 1, | ||
| "expandInnerObjects": true, | ||
| "endpointPath": "{{index}}/_search", | ||
| "postRequestScript": "search.js", | ||
| "getArgs": [], | ||
| "headers": [], | ||
| "postBody": "{{query}}" | ||
richbenwell marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| "ui": [ | ||
| { | ||
| "name": "index", | ||
| "type": "autocomplete", | ||
| "label": "Index", | ||
| "validation": { | ||
| "required": true | ||
| }, | ||
| "placeholder": "Select index", | ||
| "isMulti": false, | ||
| "allowCustomValues": true, | ||
| "data": { | ||
| "source": "dataStream", | ||
| "dataStreamName": "indices" | ||
| } | ||
| }, | ||
| { | ||
| "name": "query", | ||
| "type": "json", | ||
| "defaultValue": { | ||
| "size": 100 | ||
| }, | ||
| "label": "Query body", | ||
| "help": "The Query DSL JSON. See [OpenSearch API docs](https://docs.opensearch.org/latest/api-reference/search-apis/search/#request-body).", | ||
|
||
| "validation": { | ||
| "required": true | ||
| } | ||
| } | ||
| ], | ||
| "supportsNoneTimeframe": true, | ||
| "requiresParameterTimeframe": true, | ||
| "defaultTimeframe": "none" | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Configuration | ||
|
|
||
| ## Instance URL | ||
|
Comment on lines
+1
to
+3
|
||
|
|
||
| The base URL of your OpenSearch database. | ||
|
|
||
| For example: | ||
| `https://<your-opensearch-host>:9200` | ||
|
|
||
| Do *not* include the `/api` path. | ||
|
|
||
| ## Authentication | ||
richbenwell marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| The data source supports basic (username and password) or anonymous authentication. | ||
|
|
||
| If using basic authentication, ensure the user only has read permissions. | ||
|
|
||
| If using anonymous, ensure the endpoint is secured in some other form. | ||
|
|
||
| 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. | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,45 @@ | ||||||
| { | ||||||
| "name": "open-search", | ||||||
| "displayName": "OpenSearch", | ||||||
| "version": "1.0.3", | ||||||
|
||||||
| "version": "1.0.3", | |
| "version": "1.0.4", |
Copilot
AI
Feb 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
author.type is set to "labs", but repository guidance and existing plugins use "community" for community-authored plugins. Please update author.type to community and set author.name to a GitHub username (e.g. @username) or an organisation name.
Copilot
AI
Feb 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the custom guidelines, for community-authored plugins, the author type should be set to "community" and the name should typically be a GitHub username prefixed with @ (e.g., "@username") or an organization name. The PR description indicates this is a community contribution, but the metadata shows "SquaredUp Labs" with type "labs". Please update to reflect the actual community author, for example:
"author": {
"name": "@yourusername",
"type": "community"
}
Copilot
AI
Feb 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the custom guidelines, the description should focus on what users can build or monitor, avoiding API or implementation language. The current description "Query OpenSearch databases using DSL" is quite technical. Consider rephrasing to something more user-focused, such as "Monitor and analyze data from OpenSearch databases." to better describe what users can achieve with this plugin.
richbenwell marked this conversation as resolved.
Show resolved
Hide resolved
Copilot
AI
Feb 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation link points to docs/setup.md, but other plugins consistently link category: documentation to docs/README.md (e.g. plugins/UniFi/v1/metadata.json:31-35). SquaredUp also only renders docs/README.md in-product, so this should be renamed/moved to docs/README.md and the URL updated accordingly.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| [ | ||
| { | ||
| "type": "text", | ||
| "name": "instanceUrl", | ||
| "label": "Instance URL", | ||
|
||
| "validation": { "required": true }, | ||
| "placeholder": "Enter the OpenSearch URL" | ||
|
||
| }, | ||
| { | ||
| "name": "authMode", | ||
| "type": "radio", | ||
| "label": "Authentication", | ||
| "help": "**Basic:** Authenticate with username and password. \n**Anonymous access:** No authentication required", | ||
|
||
| "defaultValue": "basic", | ||
| "validation": { | ||
| "required": true | ||
| }, | ||
| "options": [ | ||
| { | ||
| "label": "Basic", | ||
| "value": "basic" | ||
| }, | ||
| { | ||
| "label": "Anonymous access", | ||
| "value": "none" | ||
| } | ||
|
|
||
| ] | ||
| }, | ||
|
Comment on lines
+9
to
+29
|
||
| { | ||
| "type": "fieldGroup", | ||
| "visible": { | ||
| "authMode": "basic" | ||
| }, | ||
| "fields": [ | ||
| { | ||
| "type": "text", | ||
| "name": "basicAuthUsername", | ||
| "label": "Username", | ||
| "validation": { "required": true }, | ||
| "placeholder": "Enter a username" | ||
| }, | ||
| { | ||
| "type": "password", | ||
| "name": "basicAuthPassword", | ||
| "label": "Password", | ||
| "validation": { "required": true }, | ||
| "placeholder": "Enter a password" | ||
richbenwell marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "type": "checkbox", | ||
| "name": "ignoreCertificateErrors", | ||
| "label": "Ignore certificate errors", | ||
| "help": "Ignore certificate errors when connecting to an OpenSearch instance with a self-signed certificate" | ||
| } | ||
| ] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This plugin adds a top-level
README.md, but other plugins typically provide end-user help indocs/README.md(and metadata links point there). Consider moving this content intodocs/README.md; also avoid starting with an "Overview" heading per repo doc guidance for embedded help.