-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Enterprise Search] Add preferences to connectors #150165
[Enterprise Search] Add preferences to connectors #150165
Conversation
Ah, I don't think we need the 'label'/'value' construction for these, I don't think we'll pull the name or description for these preferences from the document in any case. We can just give these straight values. |
@sphilipse I've changed it to a generic key:value pair, thanks for the feedback! |
I'd consider making the contents of preferences explicitly mapped so that we can potentially search over them, like "get me all connectors that have this setting". |
@sphilipse I've added |
@@ -27,6 +27,8 @@ export interface CustomScheduling { | |||
|
|||
export type ConnectorCustomScheduling = Record<string, CustomScheduling | null>; | |||
|
|||
export type ConnectorPreferences = Record<string, unknown>; |
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.
Should update this type too :)
Something like:
export interface ConnectorPreferences {
extract_full_html: boolean | null;
}
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.
@sphillipse Would something like this work? (keeping in mind that there may be more fields added in the future)
export interface Preferences {
extract_full_html: boolean;
}
export type ConnectorPreferences = Preferences | Record<string, unknown>;
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.
Didn't see your edit, will add. Cheers!
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.
If you wanted to do it in an extensible way, you'd do something like:
export interface ConnectorPreferences extends Record<string, unknown> {
extract_full_html: boolean | null;
}
Your way is almost correct, but means it's either an object with the defined properties, or an object of shape Record<string, unknown>. In the second case, extract_full_html
could be anything--so you lose the advantage of typing. Extending it gets rid of that issue.
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.
I like this extensible way so I'm going to use it
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: |
Summary
Add support for new field
preferences
in.elastic-connectors
.Related PRs:
Checklist