-
Notifications
You must be signed in to change notification settings - Fork 66
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
Add dataset_types to package info #511
Conversation
As this does not remove / change the /categories endpoint yet, this can be merged and the change in Kibana can follow. Issue filed here: elastic/kibana#69252 |
@@ -48,6 +49,12 @@ func searchHandler(packagesBasePath string, cacheTime time.Duration) func(w http | |||
} | |||
} | |||
|
|||
if v := query.Get("dataset.type"); v != "" { |
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.
nit: dataset_type
?
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 is by design. I want to stay as close as possible to the actual fields used in the events. So the query is really dataset.type=logs
like it is inside Elasticsearch.
types.go
Outdated
|
||
data, err := getTypesOutput(types) | ||
if err != nil { | ||
notFoundError(w, err) |
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 think you can get here a marshaling error. It would be great if the app logs this one.
util/package.go
Outdated
@@ -50,6 +50,8 @@ type Package struct { | |||
Datasources []Datasource `config:"datasources,omitempty" json:"datasources,omitempty" yaml:"datasources,omitempty"` | |||
Download string `json:"download" yaml:"download,omitempty"` | |||
Path string `json:"path" yaml:"path,omitempty"` | |||
// This is in purpose `dataset.types` with an "s" as it is a summary of the existing dataset types |
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.
nit: on purpose:
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.
fixed
util/package.go
Outdated
@@ -50,6 +50,8 @@ type Package struct { | |||
Datasources []Datasource `config:"datasources,omitempty" json:"datasources,omitempty" yaml:"datasources,omitempty"` | |||
Download string `json:"download" yaml:"download,omitempty"` | |||
Path string `json:"path" yaml:"path,omitempty"` | |||
// This is in purpose `dataset.types` with an "s" as it is a summary of the existing dataset types | |||
DatasetTypes []string `json:"dataset.types" yaml:"dataset.types,omitempty"` |
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 both ones have the omitempty
annotation?
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.
yes, and I realised that we don't need the yaml part as it never shows up in yaml.
The type API endpoint exposes the number of packages with a dataset of a certain type exists. Today this is what is exposed by the category endpoint but this will be repurposed. The value of the type is based on the dataset.type field, indirectly the type definition inside the dataset manifest. It is expected that Kibana switches over to using this endpoint and then the category endpoint can be refactored. What is currently exposed under category is not really categories.
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 removed the /types
endpoint from this PR as it turned out we don't need it for the next release. But we potentially need the types info of the dataset types in a package on the search endpoint. Will update the PR description and add more changes for it.
util/package.go
Outdated
@@ -50,6 +50,8 @@ type Package struct { | |||
Datasources []Datasource `config:"datasources,omitempty" json:"datasources,omitempty" yaml:"datasources,omitempty"` | |||
Download string `json:"download" yaml:"download,omitempty"` | |||
Path string `json:"path" yaml:"path,omitempty"` | |||
// This is in purpose `dataset.types` with an "s" as it is a summary of the existing dataset types |
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.
fixed
util/package.go
Outdated
@@ -50,6 +50,8 @@ type Package struct { | |||
Datasources []Datasource `config:"datasources,omitempty" json:"datasources,omitempty" yaml:"datasources,omitempty"` | |||
Download string `json:"download" yaml:"download,omitempty"` | |||
Path string `json:"path" yaml:"path,omitempty"` | |||
// This is in purpose `dataset.types` with an "s" as it is a summary of the existing dataset types | |||
DatasetTypes []string `json:"dataset.types" yaml:"dataset.types,omitempty"` |
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.
yes, and I realised that we don't need the yaml part as it never shows up in yaml.
Waiting for #529 to get in to continue work on this PR. I converted above |
I'm closing this for now as it turned out we will not need it yet for the next release. |
To be updated