@openstax/ts-utils 1.32.7 → 1.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,4 +24,5 @@ export declare const openSearchService: <C extends string = "deployed">(initiali
24
24
  totalItems: number;
25
25
  totalPages: number;
26
26
  }>;
27
+ updateMappings: () => Promise<void>;
27
28
  };
@@ -133,6 +133,18 @@ export const openSearchService = (initializer = {}) => (configProvider) => {
133
133
  const totalPages = Math.ceil(totalItems / pageSize) || 1;
134
134
  return { items, pageSize, currentPage, totalItems, totalPages };
135
135
  };
136
- return { ensureIndexCreated, deleteIndexIfExists, index, bulkIndex, search };
136
+ const updateMappings = async () => {
137
+ const { indices } = await client();
138
+ await indices.putMapping({
139
+ index: indexConfig.name,
140
+ body: {
141
+ properties: indexConfig.mappings
142
+ }
143
+ }, {
144
+ requestTimeout: 10000,
145
+ maxRetries: 1,
146
+ });
147
+ };
148
+ return { ensureIndexCreated, deleteIndexIfExists, index, bulkIndex, search, updateMappings };
137
149
  };
138
150
  };