Search PoC: Indexmapping per resource and transform to intermediate IndexedResource (#94906)

* Transforms raw US resource into an intermediate IndexableResource and indexes that. Pulls index mapping code out into different file. For now, we will hardcode which spec fields are indexed, per resource.

* Fixes a few bugs with field casing and timestamps not being formatted right (or not existing).

* adds readme section for using search with US

* extracts to function to transform from search hit to IndexedResource

* get folders when building index
This commit is contained in:
owensmallwood
2024-10-21 09:34:41 -06:00
committed by GitHub
parent 40f0a72db0
commit fb9cfd0d1b
3 changed files with 243 additions and 82 deletions
+21
View File
@@ -270,3 +270,24 @@ go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
```
- make changes in `.proto` file
- to compile all protobuf files in the repository run `make protobuf` at its top level
## Setting up search (EXPERIMENTAL)
Unified storage now exposes an **experimental** search API. It can be used to search for specific resources, or to filter/query resources.
To enable it, add the following to your `custom.ini` under the `[feature_toggles]` section:
```ini
[feature_toggles]
unifiedStorageSearch = true
```
To access the api through Grafana, go to Explore -> Query Type -> Search.
The query needs to be a valid [Bleve query string](https://blevesearch.com/docs/Query-String-Query/).
Some example queries are:
- `*` - returns all objects
- `Kind:Playlist` - returns all playlists
- `Spec.inveral:5m` - returns all objects with the spec.inverval field set to 5m
- `+Kind:Playlist +Spec.title:p4` - returns all playlists with the title matching "p4"
- `*foo*` - returns all objects containing "foo" in any field
- `CreatedAt:>="2024-10-17"` - returns all objects created after 2024-10-17
- `+CreatedAt:>="2024-10-17" +Kind:Playlist` - returns all playlists created after 2024-10-17