Implement content packages discovery#1235
Conversation
|
@mrodm do you know how the search-index-all-full.json can be regenerated? I would like to add content packages there. |
| sort.Strings(keys) | ||
|
|
||
| var outputCategories []*packages.Category | ||
| outputCategories := []*packages.Category{} |
There was a problem hiding this comment.
Unrelated change. It changes the response of the /categories endpoint to generate [] instead of null when no packages satisfy the conditions.
The last time I had to add new packages (and update this file), I did it manually. |
| } | ||
|
|
||
| func NewDiscoveryFilter(filter string) (*DiscoveryFilter, error) { | ||
| filterType, args, found := strings.Cut(filter, ":") |
There was a problem hiding this comment.
Currently, it is supported just once type of discovery field so this looks good for a query like this:
GET /search?discovery=fields:process.pid,user.id
If it is needed to add a second type of discovery field, in order to get all the values of these query parameters, would it be needed to repeat the query parameter?
GET /search?discovery=fields:process.pid,user.id&discovery=searches:foo,bar
There was a problem hiding this comment.
Currently we only have a type of discovery method, so I didn't add support for more.
If we had, a request using more than one would require setting the parameter multiple times, yes.
I can add support for this, though it wouldn't be really useful at the moment. What do you prefer?
There was a problem hiding this comment.
No need to add support for several discovery methods now, just wanted to check one option about how to define another field in the query. Adding multiple times discovery looks good I think. 👍
There was a problem hiding this comment.
Do you think I should add support for discovery appearing multiple times?
So these two queries would be equivalent:
GET /search?discovery=fields:process.pid&discovery=fields:user.id
GET /search?discovery=fields:process.pid,user.id
This would also serve as base to add other methods. Though I don't think this would be very useful by now.
There was a problem hiding this comment.
Probably, it is not required to do it now. I guess Kibana could put all the fields required in one query parameter, WDYT?
There was a problem hiding this comment.
Yes, there would be no reason to separate in multiple parameters.
Co-authored-by: Mario Rodriguez Molins <marrodmo@gmail.com>
💚 Build Succeeded
History
cc @jsoriano |
Fixes #1229.
Add a new
discoveryparameter to/searchand/categoriesendpoints, to filter packages based on their discovery fields. It supports a list of fields that has to be passed in the formfields:<comma-separated list of fields>. To pass the filter, packages must include discovery fields in their manifest, and all of them must be included in the list included in the parameter.For example the following request will return prerelease packages of content type, whose discovery subfields are a subset of ['http.method', 'apache.status.total_bytes'].