Skip to content
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

Discover Changes for Point in Time POC #4

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 4 additions & 4 deletions config/opensearch_dashboards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,9 @@

# Set the value of this setting to true to enables the experimental multiple data source
# support feature. Use with caution.
#data_source.enabled: false
data_source.enabled: true
# Set the value of these settings to custermize crypto materials to encryption saved credentials
# in data sources.
#data_source.encryption.wrappingKeyName: 'changeme'
#data_source.encryption.wrappingKeyNamespace: 'changeme'
#data_source.encryption.wrappingKey: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
data_source.encryption.wrappingKeyName: 'changeme'
data_source.encryption.wrappingKeyNamespace: 'changeme'
data_source.encryption.wrappingKey: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"angular-elastic": "^2.5.1",
"angular-sanitize": "^1.8.0",
"bluebird": "3.5.5",
"caniuse-lite": "^1.0.30001397",
"chalk": "^4.1.0",
"chokidar": "^3.4.2",
"color": "1.0.3",
Expand Down Expand Up @@ -212,6 +213,7 @@
"type-detect": "^4.0.8",
"uuid": "3.3.2",
"whatwg-fetch": "^3.0.0",
"yarn": "^1.22.19",
"yauzl": "^2.10.0"
},
"devDependencies": {
Expand Down Expand Up @@ -461,4 +463,4 @@
"node": "14.20.0",
"yarn": "^1.21.1"
}
}
}
1 change: 1 addition & 0 deletions src/core/server/opensearch/legacy/cluster_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const callAPI = async (
) => {
const clientPath = endpoint.split('.');
const api: any = get(client, clientPath);
console.log("This is the low level client call", clientPath, get(client, clientPath));
if (!api) {
throw new Error(`called with an invalid endpoint: ${endpoint}`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export function createIndexPatternCache(): PatternCache {
},
set: (id: string, prom: any) => {
vals[id] = prom;
console.log("This is the set value", prom);
return prom;
},
clear: (id: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ export function getSearchParamsFromRequest(
const { getConfig } = dependencies;
const searchParams = getSearchParams(getConfig);

if (searchRequest.body.pit) {
console.log("pit is present");
delete searchParams.preference;
return {
body: searchRequest.body, ...searchParams,
};
} else {
console.log("PIT is not present here");
}
return {
index: searchRequest.index.title || searchRequest.index,
body: searchRequest.body,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* under the License.
*/

import { GetFieldsOptions, IIndexPatternsApiClient } from '../../common/index_patterns/types';
import { GetFieldsOptions, IIndexPatternsApiClient } from '../../common';

export class IndexPatternsApiServer implements IIndexPatternsApiClient {
async getFieldsForTimePattern(options: GetFieldsOptions = {}) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export async function getDefaultSearchParams(uiSettingsClient: IUiSettingsClient
maxConcurrentShardRequests:
maxConcurrentShardRequests > 0 ? maxConcurrentShardRequests : undefined,
ignoreThrottled,
ignoreUnavailable: true, // Don't fail if the index/indices don't exist
ignoreUnavailable: false, // Don't fail if the index/indices don't exist
Copy link
Owner Author

Choose a reason for hiding this comment

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

Need to make a different function to be called for fetching the default params for PIT searches.

trackTotalHits: true,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,17 @@ export const opensearchSearchStrategyProvider = (

// ignoreThrottled is not supported in OSS
const { ignoreThrottled, ...defaultParams } = await getDefaultSearchParams(uiSettingsClient);

console.log("these are the default params",defaultParams)
const params = toSnakeCase({
...defaultParams,
...getShardTimeout(config),
...request.params,
});

if (params.body.pit) {
Copy link
Owner Author

@Arpit-Bandejiya Arpit-Bandejiya Oct 20, 2022

Choose a reason for hiding this comment

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

We will need to make changes in the search strategy as well since there are some fields which can't be passed in PIT search.

console.log("deleting the ignore unavailable values ");
delete params.ignore_unavailable;
}
console.log("these are the params",params);
try {
const client = await decideClient(context, request);
const promise = shimAbortSignal(client.search(params), options?.abortSignal);
Expand Down
Loading