Skip to content

Commit f3b7750

Browse files
committed
Issue #20: add _field_caps support
1 parent 67f56ba commit f3b7750

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

pkg/quickwit/quickwit.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ func (ds *QuickwitDatasource) CallResource(ctx context.Context, req *backend.Cal
143143
// - empty string for fetching db version
144144
// - ?/_mapping for fetching index mapping
145145
// - _msearch for executing getTerms queries
146-
if req.Path != "" && !strings.Contains(req.Path, "indexes/") && req.Path != "_elastic/_msearch" {
146+
// - _field_caps for getting all the aggregeables fields
147+
var isFieldCaps = req.Path != "" && strings.Contains(req.Path, "_elastic") && strings.Contains(req.Path, "/_field_caps")
148+
if req.Path != "" && !strings.Contains(req.Path, "indexes/") && req.Path != "_elastic/_msearch" && !isFieldCaps {
147149
return fmt.Errorf("invalid resource URL: %s", req.Path)
148150
}
149151

src/datasource.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ export class QuickwitDataSource
348348
datetime: 'date',
349349
text: 'string',
350350
};
351-
return from(this.getResource('indexes/' + this.index)).pipe(
351+
return from(this.getResource('_elastic/' + this.index + '/_field_caps')).pipe(
352352
map((index_metadata) => {
353353
const shouldAddField = (field: QuickwitField) => {
354354
const translated_type = typeMap[field.field_mapping.type];

0 commit comments

Comments
 (0)