Skip to content

Commit

Permalink
Merge pull request #19 from polarityio/develop
Browse files Browse the repository at this point in the history
INT-1128: Fix default search, improve error metadata for troubleshooting, bump dependencies
  • Loading branch information
sarus committed Feb 26, 2024
2 parents fcdb8de + 7568bf8 commit 74be052
Show file tree
Hide file tree
Showing 5 changed files with 197 additions and 42 deletions.
2 changes: 1 addition & 1 deletion config/config.js
Expand Up @@ -106,7 +106,7 @@ module.exports = {
description:
"The search query to execute as JSON. The top level property should be a `query` object and must be a valid JSON search request when sent to the ES `_search` REST endpoint. Use the 'Page Size' option to control 'size' and 'from' parameters.",
default:
'{"query": { "simple_query_string": { "query": "\\"{{entity}}\\"" } }, "from": 0, "size": 10, "sort": [ {"timestamp": "desc" } ] } }',
'{"query": { "simple_query_string": { "query": "\\"{{entity}}\\"" } }, "from": 0, "size": 10 }',
type: 'text',
userCanEdit: false,
adminOnly: true
Expand Down
10 changes: 5 additions & 5 deletions config/config.json
Expand Up @@ -94,16 +94,16 @@
{
"key": "query",
"name": "Search Query",
"description": "The search query to execute as JSON. The top level property should be a `query` object and must be a valid JSON search request when sent to the ES `_search` REST endpoint. Use the 'Page Size' option to control 'size' and 'from' parameters.",
"default": "{\"query\": { \"simple_query_string\": { \"query\": \"\\\"{{entity}}\\\"\" } }, \"from\": 0, \"size\": 10, \"sort\": [ {\"timestamp\": \"desc\" } ] } }",
"description": "The search query to execute as JSON. The top level property should be a `query` object and must be a valid JSON search request when sent to the ES `_search` REST endpoint. Use the 'Page Size' option to control 'size' and 'from' parameters.",
"default": "{\"query\": { \"simple_query_string\": { \"query\": \"\\\"{{entity}}\\\"\" } }, \"from\": 0, \"size\": 10 }",
"type": "text",
"userCanEdit": false,
"adminOnly": true
},
{
"key": "defaultPageSize",
"name": "Page Size",
"description": "The number of results to display per page. This value must be between 1 and 100. Defaults to 10. This option should be set to \"Only admins can view and edit\".",
"description": "The number of results to display per page. This value must be between 1 and 100. Defaults to 10. This option should be set to \"Only admins can view and edit\".",
"default": 10,
"type": "number",
"userCanEdit": false,
Expand All @@ -121,7 +121,7 @@
{
"key": "highlightQuery",
"name": "Highlight Query",
"description": "The highlighter query to execute when a user clicks to view additional details. The top level property should be a `query` object. This query should typically match the query portion of your `Search Query`. Only runs if the `Enable Highlighting` option is checked",
"description": "The highlighter query to execute when a user clicks to view additional details. The top level property should be a `query` object. This query should typically match the query portion of your `Search Query`. Highlighting will attempt to highlight against all fields. Only runs if the `Enable Highlighting` option is checked",
"default": "{\"query\": { \"simple_query_string\": { \"query\": \"\\\"{{entity}}\\\"\" } } }",
"type": "text",
"userCanEdit": false,
Expand All @@ -139,7 +139,7 @@
{
"key": "maxSummaryTags",
"name": "Maximum Number of Summary Tags",
"description": "The maximum number of summary tags to display in the Overlay Window before showing a count. If set to 0, all tags will be shown.",
"description": "The maximum number of summary tags to display in the Overlay Window before showing a count. If set to 0, all tags will be shown.",
"default": 5,
"type": "number",
"userCanEdit": false,
Expand Down
8 changes: 6 additions & 2 deletions integration.js
Expand Up @@ -87,7 +87,11 @@ function getAuthHeader(options, headers = {}) {
}

function parseErrorToReadableJSON(error) {
return JSON.parse(JSON.stringify(error, Object.getOwnPropertyNames(error)));
if (error instanceof Error) {
return JSON.parse(JSON.stringify(error, Object.getOwnPropertyNames(error)));
} else {
return error;
}
}

function doLookup(entities, options, cb) {
Expand Down Expand Up @@ -685,7 +689,7 @@ function _handleRestErrors(response, body) {
'7',
'There is an error with the search query.',
{
body: body
body
}
);
}
Expand Down
217 changes: 184 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "Elasticsearch",
"version": "3.6.2",
"version": "3.6.3",
"main": "./integration.js",
"description": "Search your data in real-time",
"private": true,
Expand Down

0 comments on commit 74be052

Please sign in to comment.