Skip to content

Commit

Permalink
allow_no_index return default to false
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkime committed Jan 10, 2023
1 parent 6978eb6 commit 77620d1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/plugins/data_views/common/data_views/data_views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ export class DataViewsService {
return this.apiClient.getFieldsForWildcard({
type: dataView.type,
rollupIndex: dataView?.typeMeta?.params?.rollup_index,
allowNoIndex: dataView.allowNoIndex,
allowNoIndex: true, // dataView.allowNoIndex, - what should we do when setting this?
pattern: dataView.getIndexPattern(),
metaFields,
});
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/data_views/server/fetcher/lib/es_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export async function callFieldCapsApi(params: FieldCapsApiParams) {
indices,
indexFilter,
fieldCapsOptions = {
allow_no_indices: true, // CHANGE TO DEFAULT TO TRUE
allow_no_indices: false,
include_unmapped: false,
},
fields = ['*'],
Expand All @@ -82,6 +82,7 @@ export async function callFieldCapsApi(params: FieldCapsApiParams) {
},
{ meta: true }
);
// this may need twweaking based on allow_no_index
if (caps.body.indices.length === 0) {
const pattern = Array.isArray(indices) ? indices.join(',') : indices;
throw new DataViewMissingIndices(pattern);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data_views/server/routes/fields_for.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const handler: RequestHandler<{}, IQuery, IBody> = async (context, request, resp
type,
rollupIndex,
fieldCapsOptions: {
allow_no_indices: allowNoIndex || true,
allow_no_indices: allowNoIndex || false,
includeUnmapped,
},
indexFilter,
Expand Down

0 comments on commit 77620d1

Please sign in to comment.