Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions plugins/OpenSearch/v1/README.md
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.
Comment on lines +1 to +3
Copy link

Copilot AI Feb 11, 2026

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 in docs/README.md (and metadata links point there). Consider moving this content into docs/README.md; also avoid starting with an "Overview" heading per repo doc guidance for embedded help.

Suggested change
## Overview
Query OpenSearch databases using DSL. This plugin is primarily a wrapper around the `_search` API endpoint that allows for a range of queries.
# Before you start
Refer to `docs/README.md` in this plugin folder for full setup and usage instructions for the OpenSearch plugin.

Copilot uses AI. Check for mistakes.

See the [OpenSearch API docs](https://docs.opensearch.org/latest/api-reference/search-apis/search/) for more information.

Comment on lines +1 to +6
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is named README.md under the plugin version folder, but other plugins keep end-user setup docs under docs/README.md and don’t include a top-level README.md. Additionally, the PR description/checklist says the README includes configuration guidance, but this file is only an overview. Consider moving/merging this content into docs/README.md so users can find both overview + configuration in one place.

Copilot uses AI. Check for mistakes.
28 changes: 28 additions & 0 deletions plugins/OpenSearch/v1/dataStreams/indices.json
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",
"pathToData": "",
"getArgs": [],
"headers": []
},
"timeframes": false,
"matches": "none",
"visibility": {
"type": "hidden"
},
"metadata": [
{
"name": "index",
"shape": "string",
"displayName": "Index",
"role": "value"
}
]
}
29 changes: 29 additions & 0 deletions plugins/OpenSearch/v1/dataStreams/scripts/search.js
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
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script assumes that when there are no aggregations, data.hits.hits will always exist and have a _source property. However, if the OpenSearch query fails or returns an unexpected structure, this could cause a runtime error. Consider adding defensive checks to handle cases where data.hits or data.hits.hits might be undefined, or where individual hits might not have a _source property.

Suggested change
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);

Copilot uses AI. Check for mistakes.
}
50 changes: 50 additions & 0 deletions plugins/OpenSearch/v1/dataStreams/search.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "search",
"displayName": "Search",
Comment on lines +2 to +3
Copy link

Copilot AI Feb 13, 2026

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, dataStreams should have a description field that is typically one sentence only with no full stop at the end. Consider adding a description to this data stream, such as "Query OpenSearch indices using DSL syntax" to help users understand what this data stream does.

Copilot generated this review using guidance from repository custom instructions.
"baseDataSourceName": "httpRequestUnscoped",
Comment on lines +2 to +4
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data stream displayName should be noun-based per repo guidelines; Search reads as a verb/action. Consider renaming to something like "Search results"/"Results" (whatever best matches the returned shape).

Copilot generated this review using guidance from repository custom instructions.
"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}}"
},
"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).",
Copy link

Copilot AI Feb 13, 2026

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, help text should "Start with a verb where possible". The current help text "The Query DSL JSON. See [OpenSearch API docs]..." starts with "The" rather than a verb. Consider rephrasing to start with a verb, such as "Specify the Query DSL JSON. See [OpenSearch API docs]..." or "Enter the Query DSL JSON. See [OpenSearch API docs]..." to follow the guideline more closely.

Copilot generated this review using guidance from repository custom instructions.
"validation": {
"required": true
}
}
],
"supportsNoneTimeframe": true,
"requiresParameterTimeframe": true,
"defaultTimeframe": "none"
}
21 changes: 21 additions & 0 deletions plugins/OpenSearch/v1/docs/setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Configuration

## Instance URL
Comment on lines +1 to +3
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs are provided as docs/setup.md, but the repo convention (and in-product rendering) is docs/README.md. Also, the top heading here is # Configuration, whereas other plugins start with task-focused headings like # Before you start (e.g. plugins/UniFi/v1/docs/README.md:1). Please rename to docs/README.md and align the heading structure so setup guidance is what users see in SquaredUp.

Copilot uses AI. Check for mistakes.

The base URL of your OpenSearch database.

For example:
`https://<your-opensearch-host>:9200`

Do *not* include the `/api` path.

## Authentication

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.

6 changes: 6 additions & 0 deletions plugins/OpenSearch/v1/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions plugins/OpenSearch/v1/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "open-search",
"displayName": "OpenSearch",
"version": "1.0.3",
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding an explicit CODEOWNERS entry for this new plugin so future changes request review from the plugin author (see .github/CODEOWNERS, which lists each existing plugin).

Suggested change
"version": "1.0.3",
"version": "1.0.4",

Copilot uses AI. Check for mistakes.
"author": {
"name": "SquaredUp Labs",
"type": "labs"
},
Comment on lines +5 to +8
Copy link

Copilot AI Feb 11, 2026

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 uses AI. Check for mistakes.
Comment on lines +5 to +8
Copy link

Copilot AI Feb 13, 2026

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 generated this review using guidance from repository custom instructions.
"description": "Query OpenSearch databases using DSL.",
Copy link

Copilot AI Feb 13, 2026

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.

Copilot generated this review using guidance from repository custom instructions.
"category": "Database",
"type": "cloud",
"restrictedToPlatforms": [],
"importNotSupported": true,
"schemaVersion": "2.0",
"base": {
"plugin": "WebAPI",
"majorVersion": "1",
"config": {
"authMode": "{{authMode}}",
"basicAuthUsername": "{{basicAuthUsername}}",
"basicAuthPassword": "{{basicAuthPassword}}",
"queryArgs": [],
"headers": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"baseUrl": "{{instanceUrl}}",
"ignoreCertificateErrors": "{{ignoreCertificateErrors}}"
}
},
"links": [
{
"category": "documentation",
"url": "https://github.com/squaredup/plugins/blob/main/plugins/OpenSearch/v1/docs/setup.md",
"label": "Help adding this plugin"
Comment on lines +33 to +37
Copy link

Copilot AI Feb 12, 2026

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.

Copilot uses AI. Check for mistakes.
},
{
"category": "source",
"url": "https://github.com/squaredup/plugins/tree/main/plugins/OpenSearch/v1",
"label": "Repository"
}
]
}
58 changes: 58 additions & 0 deletions plugins/OpenSearch/v1/ui.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[
{
"type": "text",
"name": "instanceUrl",
"label": "Instance URL",
Copy link

Copilot AI Feb 13, 2026

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 ui.json fields, labels should follow the pattern "First word uppercase, then lowercase" (e.g., "Table name" or "API key"). The current label "Instance URL" has both words capitalized. Consider changing it to "Instance url" to align with the guidelines, though "URL" is commonly capitalized as an acronym. If keeping "URL" capitalized, this should be consistent with other similar fields in the codebase.

Copilot generated this review using guidance from repository custom instructions.
"validation": { "required": true },
"placeholder": "Enter the OpenSearch URL"
Copy link

Copilot AI Feb 13, 2026

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, ui.json placeholders should use example values where a value follows a fixed pattern. For a URL field, consider providing a more specific example placeholder that shows the expected format, such as "https://your-opensearch-host:9200" instead of the generic instruction "Enter the OpenSearch URL".

Copilot generated this review using guidance from repository custom instructions.
},
{
"name": "authMode",
"type": "radio",
"label": "Authentication",
"help": "**Basic:** Authenticate with username and password. \n**Anonymous access:** No authentication required",
Copy link

Copilot AI Feb 13, 2026

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, help text should "Start with a verb where possible". The current help text describes the authentication modes but doesn't start with a verb. Consider rephrasing to start with a verb, such as "Choose Basic to authenticate with username and password, or Anonymous access when no authentication is required." However, given the multi-option format with markdown bold formatting, the current structure may be acceptable for clarity.

Copilot generated this review using guidance from repository custom instructions.
"defaultValue": "basic",
"validation": {
"required": true
},
"options": [
{
"label": "Basic",
"value": "basic"
},
{
"label": "Anonymous access",
"value": "none"
}

]
},
Comment on lines +9 to +29
Copy link

Copilot AI Feb 13, 2026

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, API tokens or OAuth are preferred over username/password authentication where possible. OpenSearch supports API key authentication as an alternative to basic authentication. Consider adding support for API key authentication to provide a more secure authentication option. If basic authentication is the only viable option for your use case, this is acceptable, but API keys would be preferred.

Copilot generated this review using guidance from repository custom instructions.
{
"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"
}
]
},
{
"type": "checkbox",
"name": "ignoreCertificateErrors",
"label": "Ignore certificate errors",
"help": "Ignore certificate errors when connecting to an OpenSearch instance with a self-signed certificate"
}
]
Loading