@delali/narsil 0.3.1-next.130 → 0.3.1-next.140
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.
- package/dist/adapters/filesystem.mjs +1 -1
- package/dist/adapters/indexeddb.mjs +1 -1
- package/dist/analysis-change-JN23AZQP.mjs +43 -0
- package/dist/analysis-change-entry-5JSIMEKG.mjs +1 -0
- package/dist/browser/analysis-change-57MIRJWR.mjs +499 -0
- package/dist/browser/analysis-change-entry-ICGRR3IN.mjs +1 -0
- package/dist/browser/{chunk-UDGB2MWT.mjs → chunk-35B42UFM.mjs} +4 -0
- package/dist/browser/{chunk-VBBLTD7O.mjs → chunk-3EYDURFD.mjs} +39 -27
- package/dist/browser/{chunk-AIIJDWMG.mjs → chunk-4MFH226Q.mjs} +1 -1
- package/dist/browser/{chunk-D7WQF6DV.mjs → chunk-5LYWZJE2.mjs} +2 -2
- package/dist/browser/chunk-67KSBUYR.mjs +173 -0
- package/dist/browser/{chunk-M5UAAXGU.mjs → chunk-6BSB4N6B.mjs} +2 -2
- package/dist/browser/{chunk-NSCSR6MA.mjs → chunk-CGVBGHBX.mjs} +81 -6
- package/dist/browser/chunk-E5SFTOQR.mjs +21 -0
- package/dist/browser/{chunk-VEGHFP2P.mjs → chunk-MZI3TEOW.mjs} +4 -2
- package/dist/browser/chunk-OIZS5KIX.mjs +6 -0
- package/dist/browser/chunk-QHNNULPW.mjs +265 -0
- package/dist/browser/chunk-XVMOQQ34.mjs +384 -0
- package/dist/browser/{chunk-2Y3CO4EQ.mjs → chunk-ZAIZQOTM.mjs} +256 -777
- package/dist/browser/{durability-wiring-FNZSRH4N.mjs → durability-wiring-MTIAN6VT.mjs} +145 -50
- package/dist/browser/import-Q7MXD6BS.mjs +8 -0
- package/dist/browser/{module-4HIMOQM5.mjs → module-5J3PEUEB.mjs} +7 -6
- package/dist/browser/{phrase-module-WESYVU7K.mjs → phrase-module-HGVBO24W.mjs} +1 -1
- package/dist/{restore-queue-JAMNRC6T.mjs → browser/restore-queue-DISFECE4.mjs} +8 -2
- package/dist/browser/{runtime-3X7ZJ5T3.mjs → runtime-VEUH674B.mjs} +2 -2
- package/dist/browser/{snapshot-V7VF6BN6.mjs → snapshot-YBJ5MF2M.mjs} +36 -167
- package/dist/browser/{write-YIC2MKRY.mjs → write-RTWI5MXL.mjs} +8 -6
- package/dist/{capabilities-Bl8G9taj.d.ts → capabilities-DXAmysqJ.d.ts} +11 -11
- package/dist/{chunk-NMXRXFGZ.mjs → chunk-4GCN34JV.mjs} +2 -2
- package/dist/{chunk-SOHMMNCH.mjs → chunk-6VHWXAOI.mjs} +4 -4
- package/dist/{chunk-2C3WXBQS.mjs → chunk-74XB2SXI.mjs} +1 -1
- package/dist/{chunk-QQTXT65X.mjs → chunk-B5I3IL4H.mjs} +12 -7
- package/dist/chunk-BDIDUW2B.mjs +387 -0
- package/dist/{chunk-5LX6MOIB.mjs → chunk-C3YDYX6C.mjs} +1 -1
- package/dist/{chunk-Y4BVTQ53.mjs → chunk-CCCGEPJM.mjs} +2 -2
- package/dist/{chunk-2JWNJSNE.mjs → chunk-CPCGEIOM.mjs} +11 -8
- package/dist/chunk-CZQ33DLW.mjs +78 -0
- package/dist/{chunk-4GDLFDPZ.mjs → chunk-DD2673TX.mjs} +3 -2
- package/dist/{chunk-RNSC4NFI.mjs → chunk-EEBCDP36.mjs} +3 -1
- package/dist/{chunk-HCGJKDZV.mjs → chunk-FFVLPCLH.mjs} +1 -1
- package/dist/{chunk-WVRDRLIC.mjs → chunk-FKARMUWH.mjs} +6 -6
- package/dist/{chunk-PATMDIMN.mjs → chunk-HJJWY6PT.mjs} +1 -1
- package/dist/chunk-HMDT3I63.mjs +21 -0
- package/dist/{chunk-CZ7ISLXA.mjs → chunk-HNHCNTVG.mjs} +4 -0
- package/dist/{chunk-RWESFSJI.mjs → chunk-IBATGS3J.mjs} +87 -61
- package/dist/{chunk-Y2U5VVWX.mjs → chunk-ICW45TTU.mjs} +1 -1
- package/dist/{chunk-T4OFG4IQ.mjs → chunk-IP4HJOGC.mjs} +90 -16
- package/dist/{chunk-EUCX5K74.mjs → chunk-J3EHATEZ.mjs} +3 -3
- package/dist/{chunk-X5CNUKD5.mjs → chunk-K3AQOZVM.mjs} +37 -20
- package/dist/chunk-LK3MOTXF.mjs +174 -0
- package/dist/{chunk-7OIQ2SIO.mjs → chunk-LLDFIKGP.mjs} +4 -4
- package/dist/{chunk-K77FJXKS.mjs → chunk-MTQTX4BP.mjs} +81 -8
- package/dist/{chunk-ZR4VM4A6.mjs → chunk-N37VMC62.mjs} +1 -18
- package/dist/{chunk-2WBY4Y4M.mjs → chunk-NOT5QOHU.mjs} +1 -1
- package/dist/{chunk-D5TFRB5G.mjs → chunk-NPNK57CA.mjs} +1 -1
- package/dist/{chunk-6SSVIW7Y.mjs → chunk-O4LJQI4G.mjs} +31 -5
- package/dist/{chunk-JJ6EUMXB.mjs → chunk-PNNVTKMT.mjs} +2 -2
- package/dist/{chunk-2SEL6SBS.mjs → chunk-RKAVHNRW.mjs} +2 -2
- package/dist/{chunk-XABMCBHA.mjs → chunk-SBMAWTRG.mjs} +684 -99
- package/dist/chunk-TCWQJL7O.mjs +188 -0
- package/dist/{chunk-2MKX2SCO.mjs → chunk-U4X4AWKL.mjs} +7 -7
- package/dist/{chunk-PU6SKH7O.mjs → chunk-UBXJQJII.mjs} +2 -2
- package/dist/chunk-UEV53BBO.mjs +480 -0
- package/dist/{chunk-NNO7CO3A.mjs → chunk-UIKN2OTQ.mjs} +1 -1
- package/dist/{chunk-F6AAXI7T.mjs → chunk-VSUYTPME.mjs} +3 -3
- package/dist/{chunk-TGHNXN7W.mjs → chunk-W2XDK66Z.mjs} +180 -541
- package/dist/{chunk-7X5JST5L.mjs → chunk-WNBRW4Q2.mjs} +16 -2
- package/dist/{chunk-6M6SDH3S.mjs → chunk-XMQNOD5V.mjs} +8 -8
- package/dist/{chunk-SZGRYEIC.mjs → chunk-XS2VM7UE.mjs} +3 -3
- package/dist/{chunk-JT3YZGCE.mjs → chunk-XXKWEG53.mjs} +3 -188
- package/dist/{chunk-YBWSV5DV.mjs → chunk-ZMBFWQXN.mjs} +2 -2
- package/dist/{chunk-7XY6VD7B.mjs → chunk-ZSWHPKGM.mjs} +1 -1
- package/dist/{client-Cx-TiqPE.d.ts → client-DApBeLbk.d.ts} +18 -3
- package/dist/client.d.ts +7 -8
- package/dist/client.mjs +11 -1
- package/dist/{events-DErop1LM.d.ts → config-B0H-vp4U.d.ts} +424 -2
- package/dist/{config-CzB9YvF_.d.ts → config-Brysl9NO.d.ts} +3 -3
- package/dist/{direct-executor-HQ4QVDX7.mjs → direct-executor-J5UDLPL3.mjs} +14 -14
- package/dist/distribution/coordinator/etcd.d.ts +2 -2
- package/dist/distribution/coordinator/etcd.mjs +1 -1
- package/dist/distribution/coordinator/in-memory.d.ts +2 -2
- package/dist/distribution/transport/grpc.mjs +1 -1
- package/dist/distribution.d.ts +24 -9
- package/dist/distribution.mjs +882 -192
- package/dist/{durability-wiring-S7OX2MAI.mjs → durability-wiring-AYOTAPNQ.mjs} +165 -70
- package/dist/embeddings/openai.mjs +2 -2
- package/dist/{engine-B_W9sdZK.d.ts → engine-CuLMbH1-.d.ts} +64 -7
- package/dist/import-QRZAQ5RH.mjs +43 -0
- package/dist/{index-CKI1fDEl.d.ts → index-HYnqS1SE.d.ts} +2 -2
- package/dist/index.browser.mjs +4 -4
- package/dist/index.d.ts +6 -7
- package/dist/index.mjs +20 -20
- package/dist/{long-query-thread-WVSMIBYP.mjs → long-query-thread-U7K5A72G.mjs} +14 -14
- package/dist/{module-2E4XYSGT.mjs → module-L2OZO5PQ.mjs} +11 -11
- package/dist/partial-words.mjs +5 -5
- package/dist/pattern.mjs +3 -3
- package/dist/persistence/durability/checkpoint-worker.d.ts +12 -1
- package/dist/persistence/durability/checkpoint-worker.mjs +23 -23
- package/dist/{phrase-module-JERF2IDG.mjs → phrase-module-5QHBD2VJ.mjs} +1 -1
- package/dist/react.d.ts +11 -8
- package/dist/react.mjs +4 -0
- package/dist/{rerank-DMMT4FZA.mjs → rerank-KTLC3E6N.mjs} +5 -5
- package/dist/rerankers/http.mjs +2 -2
- package/dist/{browser/restore-queue-GEZ54CA5.mjs → restore-queue-RYSRRFS4.mjs} +8 -2
- package/dist/{runtime-7MLQ7J64.mjs → runtime-DYV75DCB.mjs} +6 -6
- package/dist/{schema-CS-clLun.d.ts → schema-BTXbHCqA.d.ts} +4 -1
- package/dist/server.d.ts +200 -11
- package/dist/server.mjs +66 -23
- package/dist/{snapshot-DOQLGGEX.mjs → snapshot-BTRZ3MZK.mjs} +59 -190
- package/dist/synonyms.mjs +6 -4
- package/dist/tasks-DjGjK70Y.d.ts +720 -0
- package/dist/{thread-DNK5XWXG.mjs → thread-USB3GOPY.mjs} +13 -13
- package/dist/vector/search-worker.d.ts +1 -1
- package/dist/vector/search-worker.mjs +5 -5
- package/dist/workers/entry.mjs +7 -7
- package/dist/{write-ZKR7SNRT.mjs → write-GHTA56OW.mjs} +25 -22
- package/openapi.json +5310 -0
- package/package.json +16 -8
- package/dist/config-hOWGBeC6.d.ts +0 -414
- package/dist/tasks-BfF-VRhm.d.ts +0 -302
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { readRecentMemoryFigures, readMemoryFigures, answerRefusalOf } from './chunk-
|
|
1
|
+
import { readRecentMemoryFigures, readMemoryFigures, answerRefusalOf } from './chunk-DD2673TX.mjs';
|
|
2
2
|
import { collectGarbageBeforeRefusal, collectYoungGenerationBeforeRefusal, reportRefusalAfterCollection, reservedHeapBytes, admitHeapBytes } from './chunk-IWVEG5CX.mjs';
|
|
3
3
|
import { nativeSearchCoreIsEnabled } from './chunk-DJHHF2L5.mjs';
|
|
4
4
|
import { DEFAULT_RERANK_WINDOW } from './chunk-HJSN7UYG.mjs';
|
|
5
|
-
import {
|
|
5
|
+
import { ANALYSIS_CHANGE_MEMBERS } from './chunk-EEBCDP36.mjs';
|
|
6
|
+
import { loadNativeCore } from './chunk-74XB2SXI.mjs';
|
|
6
7
|
import { MAX_FILTER_DEPTH } from './chunk-WQBCBKY3.mjs';
|
|
7
8
|
import { MAX_SORT_FIELDS } from './chunk-FQBFZAWG.mjs';
|
|
8
9
|
import { HEAP_BLOCK_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE } from './chunk-22YPZVMG.mjs';
|
|
9
|
-
import { NarsilError, ServerErrorCodes, ErrorCodes } from './chunk-
|
|
10
|
+
import { NarsilError, ServerErrorCodes, ErrorCodes } from './chunk-HNHCNTVG.mjs';
|
|
10
11
|
import { randomUUID } from 'crypto';
|
|
11
12
|
import { mkdtemp, open, rm } from 'fs/promises';
|
|
12
13
|
import { tmpdir } from 'os';
|
|
@@ -68,6 +69,7 @@ var ASYNC_IMPORT_CAPABILITY = "documents.import.async";
|
|
|
68
69
|
var TASK_CANCEL_CAPABILITY = "tasks.cancel";
|
|
69
70
|
var TASK_FILTER_CAPABILITY = "tasks.filter";
|
|
70
71
|
var REBUILD_ANALYSIS_CAPABILITY = "indexes.rebuildAnalysis";
|
|
72
|
+
var CHANGE_ANALYSIS_CAPABILITY = "indexes.changeAnalysis";
|
|
71
73
|
var INDEX_LIFECYCLE_CAPABILITY = "indexes.lifecycle";
|
|
72
74
|
var DOCUMENT_EXPORT_CAPABILITY = "indexes.documentExport";
|
|
73
75
|
var SYNONYMS_CAPABILITY = "indexes.synonyms";
|
|
@@ -77,6 +79,7 @@ var SERVER_CAPABILITIES = [
|
|
|
77
79
|
TASK_CANCEL_CAPABILITY,
|
|
78
80
|
TASK_FILTER_CAPABILITY,
|
|
79
81
|
REBUILD_ANALYSIS_CAPABILITY,
|
|
82
|
+
CHANGE_ANALYSIS_CAPABILITY,
|
|
80
83
|
INDEX_LIFECYCLE_CAPABILITY,
|
|
81
84
|
DOCUMENT_EXPORT_CAPABILITY,
|
|
82
85
|
SYNONYMS_CAPABILITY,
|
|
@@ -199,6 +202,10 @@ var STATUS_BY_CODE = {
|
|
|
199
202
|
PARTITION_REBALANCING_BACKPRESSURE: 409,
|
|
200
203
|
PARTITION_CAPACITY_EXCEEDED: 409,
|
|
201
204
|
RESTORE_MEMORY_EXCEEDED: 507,
|
|
205
|
+
ANALYSIS_CHANGE_REPLACED: 409,
|
|
206
|
+
ANALYSIS_CHANGE_NOT_READY: 503,
|
|
207
|
+
ANALYSIS_GENERATION_MISSING: 503,
|
|
208
|
+
ANALYSIS_REBUILD_MEMORY_EXCEEDED: 507,
|
|
202
209
|
WORKER_BUSY: 429,
|
|
203
210
|
PARTITION_CORRUPTED: 503,
|
|
204
211
|
WORKER_CRASHED: 503,
|
|
@@ -298,6 +305,7 @@ var DEFAULT_MAX_RESTORE_BYTES = 64 * 1024 * BYTES_PER_MB;
|
|
|
298
305
|
var SPOOL_PAUSE_ABOVE_BYTES = 8 * BYTES_PER_MB;
|
|
299
306
|
var SNAPSHOT_ARCHIVE_CONTENT_TYPE = "application/x-tar";
|
|
300
307
|
var DOCUMENT_EXPORT_CONTENT_TYPE = "application/x-ndjson";
|
|
308
|
+
var PROMETHEUS_TEXT_CONTENT_TYPE = "text/plain; version=0.0.4; charset=utf-8";
|
|
301
309
|
var RELAY_STREAM_CHUNKS_IN_FLIGHT = 4;
|
|
302
310
|
var DEFAULT_MAX_LINE_BYTES = 4 * BYTES_PER_MB;
|
|
303
311
|
var DEFAULT_IMPORT_BATCH_SIZE = 1e3;
|
|
@@ -872,6 +880,25 @@ function validateCreateIndex(body) {
|
|
|
872
880
|
}
|
|
873
881
|
return null;
|
|
874
882
|
}
|
|
883
|
+
function validateChangeAnalysis(body) {
|
|
884
|
+
if (typeof body !== "object" || body === null || Array.isArray(body)) {
|
|
885
|
+
return { message: "The request body must be an object" };
|
|
886
|
+
}
|
|
887
|
+
const unknownField = Object.keys(body).find((field) => !ANALYSIS_CHANGE_MEMBERS.includes(field));
|
|
888
|
+
if (unknownField !== void 0) {
|
|
889
|
+
return { message: `Field "${unknownField}" is not an analysis setting` };
|
|
890
|
+
}
|
|
891
|
+
if (body.language !== void 0 && typeof body.language !== "string") {
|
|
892
|
+
return { message: 'Field "language" must be a string' };
|
|
893
|
+
}
|
|
894
|
+
if (body.tokenizer !== void 0 && body.tokenizer !== null && typeof body.tokenizer !== "string") {
|
|
895
|
+
return { message: 'Field "tokenizer" must be a registered name or null' };
|
|
896
|
+
}
|
|
897
|
+
const stopWords = body.stopWords;
|
|
898
|
+
if (stopWords === void 0 || stopWords === null || typeof stopWords === "string") return null;
|
|
899
|
+
if (Array.isArray(stopWords) && stopWords.every((word) => typeof word === "string")) return null;
|
|
900
|
+
return { message: 'Field "stopWords" must be a registered name, a list of words, or null' };
|
|
901
|
+
}
|
|
875
902
|
function validateRebalance(body) {
|
|
876
903
|
const target = body.targetPartitionCount;
|
|
877
904
|
if (typeof target !== "number" || !Number.isInteger(target) || target <= 0) {
|
|
@@ -1105,7 +1132,8 @@ function createDocumentReadHandlers(deps) {
|
|
|
1105
1132
|
const found = await engine.getMultiple(ctx.params[0], body.docIds);
|
|
1106
1133
|
const documents = {};
|
|
1107
1134
|
for (const [id, doc] of found) documents[id] = doc;
|
|
1108
|
-
|
|
1135
|
+
const answer = { documents };
|
|
1136
|
+
await respondAnswer(ctx, answer, "documents", `a multi-get on index '${ctx.params[0]}'`);
|
|
1109
1137
|
} catch (err) {
|
|
1110
1138
|
respondError(ctx, err);
|
|
1111
1139
|
}
|
|
@@ -1268,9 +1296,15 @@ function spoolBody(res, maxBytes, abort, admitted2) {
|
|
|
1268
1296
|
paused: true,
|
|
1269
1297
|
done: false
|
|
1270
1298
|
};
|
|
1299
|
+
const resumeReading = () => {
|
|
1300
|
+
if (!state.paused || abort.aborted) return;
|
|
1301
|
+
state.paused = false;
|
|
1302
|
+
res.resume();
|
|
1303
|
+
};
|
|
1271
1304
|
const fail = (error, answer) => {
|
|
1272
1305
|
if (state.done) return;
|
|
1273
1306
|
state.done = true;
|
|
1307
|
+
resumeReading();
|
|
1274
1308
|
if (answer && !abort.aborted) {
|
|
1275
1309
|
sendError(res, 500, ServerErrorCodes.INTERNAL_ERROR, "The server could not store the request body");
|
|
1276
1310
|
}
|
|
@@ -1288,10 +1322,7 @@ function spoolBody(res, maxBytes, abort, admitted2) {
|
|
|
1288
1322
|
if (!await admitted2) throw new NotAdmittedError("the request was not admitted");
|
|
1289
1323
|
state.directory = await mkdtemp(path.join(tmpdir(), "narsil-spool-"));
|
|
1290
1324
|
state.handle = await open(path.join(state.directory, "body"), "w");
|
|
1291
|
-
if (!
|
|
1292
|
-
state.paused = false;
|
|
1293
|
-
res.resume();
|
|
1294
|
-
}
|
|
1325
|
+
if (!state.done && state.queued <= SPOOL_PAUSE_ABOVE_BYTES) resumeReading();
|
|
1295
1326
|
})();
|
|
1296
1327
|
state.chain.catch(failFromChain);
|
|
1297
1328
|
abort.onAbort(() => fail(new Error("aborted"), false));
|
|
@@ -1299,6 +1330,7 @@ function spoolBody(res, maxBytes, abort, admitted2) {
|
|
|
1299
1330
|
if (state.done || abort.aborted) return;
|
|
1300
1331
|
state.total += chunk.byteLength;
|
|
1301
1332
|
if (maxBytes > 0 && state.total > maxBytes) {
|
|
1333
|
+
resumeReading();
|
|
1302
1334
|
sendError(res, 413, ServerErrorCodes.PAYLOAD_TOO_LARGE, "Request body exceeds the configured size limit");
|
|
1303
1335
|
fail(new Error("payload too large"), false);
|
|
1304
1336
|
return;
|
|
@@ -1313,10 +1345,7 @@ function spoolBody(res, maxBytes, abort, admitted2) {
|
|
|
1313
1345
|
if (state.handle === null) throw new Error("the spool file is not open");
|
|
1314
1346
|
await state.handle.write(copy);
|
|
1315
1347
|
state.queued -= copy.byteLength;
|
|
1316
|
-
if (state.
|
|
1317
|
-
state.paused = false;
|
|
1318
|
-
res.resume();
|
|
1319
|
-
}
|
|
1348
|
+
if (!state.done && state.queued <= SPOOL_PAUSE_ABOVE_BYTES) resumeReading();
|
|
1320
1349
|
});
|
|
1321
1350
|
state.chain.catch(failFromChain);
|
|
1322
1351
|
if (!isLast) return;
|
|
@@ -1542,6 +1571,619 @@ function createRouteRunner(deps) {
|
|
|
1542
1571
|
};
|
|
1543
1572
|
}
|
|
1544
1573
|
|
|
1574
|
+
// src/server/routes/documents.ts
|
|
1575
|
+
function documentRoutes(shared) {
|
|
1576
|
+
const { named, document, writeBody, readBody: readBody2, batchBody, importBody, documentWriteBody } = shared;
|
|
1577
|
+
return [
|
|
1578
|
+
{
|
|
1579
|
+
method: "post",
|
|
1580
|
+
path: "/indexes/:name/documents",
|
|
1581
|
+
handler: "insert",
|
|
1582
|
+
options: writeBody,
|
|
1583
|
+
operationId: "insert",
|
|
1584
|
+
summary: "Insert one document",
|
|
1585
|
+
tags: ["Documents"],
|
|
1586
|
+
request: "InsertBody",
|
|
1587
|
+
responses: { 201: "DocumentIdResponse" }
|
|
1588
|
+
},
|
|
1589
|
+
{
|
|
1590
|
+
method: "post",
|
|
1591
|
+
path: "/indexes/:name/documents/_batch",
|
|
1592
|
+
handler: "batch",
|
|
1593
|
+
options: batchBody,
|
|
1594
|
+
operationId: "writeBatch",
|
|
1595
|
+
summary: "Insert, update, or remove many documents, with a result for each",
|
|
1596
|
+
tags: ["Documents"],
|
|
1597
|
+
request: "BatchBody",
|
|
1598
|
+
responses: { 200: "BatchResponse" }
|
|
1599
|
+
},
|
|
1600
|
+
{
|
|
1601
|
+
method: "post",
|
|
1602
|
+
path: "/indexes/:name/documents/_list",
|
|
1603
|
+
handler: "list",
|
|
1604
|
+
options: readBody2,
|
|
1605
|
+
operationId: "listDocuments",
|
|
1606
|
+
summary: "Read one page of stored documents",
|
|
1607
|
+
tags: ["Documents"],
|
|
1608
|
+
request: "ListParams",
|
|
1609
|
+
responses: { 200: "ListResult" },
|
|
1610
|
+
repeatable: true
|
|
1611
|
+
},
|
|
1612
|
+
{
|
|
1613
|
+
method: "post",
|
|
1614
|
+
path: "/indexes/:name/documents/_multi-get",
|
|
1615
|
+
handler: "multiGet",
|
|
1616
|
+
options: readBody2,
|
|
1617
|
+
operationId: "getMultiple",
|
|
1618
|
+
summary: "Fetch many documents by id",
|
|
1619
|
+
tags: ["Documents"],
|
|
1620
|
+
request: "MultiGetBody",
|
|
1621
|
+
responses: { 200: "MultiGetResponse" },
|
|
1622
|
+
repeatable: true
|
|
1623
|
+
},
|
|
1624
|
+
{
|
|
1625
|
+
method: "post",
|
|
1626
|
+
path: "/indexes/:name/documents/_import",
|
|
1627
|
+
handler: "importNdjson",
|
|
1628
|
+
options: importBody,
|
|
1629
|
+
operationId: "importNdjson",
|
|
1630
|
+
summary: "Load newline-delimited documents, inside the request or as a task",
|
|
1631
|
+
tags: ["Documents"],
|
|
1632
|
+
request: { contentType: DOCUMENT_EXPORT_CONTENT_TYPE },
|
|
1633
|
+
query: "ImportDocumentsQuery",
|
|
1634
|
+
responses: { 200: "ImportResult", 202: "TaskRecord" }
|
|
1635
|
+
},
|
|
1636
|
+
{
|
|
1637
|
+
method: "post",
|
|
1638
|
+
path: "/indexes/:name/_wait-for-writes",
|
|
1639
|
+
handler: "waitForWrites",
|
|
1640
|
+
options: named,
|
|
1641
|
+
operationId: "waitForWrites",
|
|
1642
|
+
summary: "Wait until every worker copy has applied the writes that returned before this request",
|
|
1643
|
+
tags: ["Documents"],
|
|
1644
|
+
request: null,
|
|
1645
|
+
responses: { 200: "OkResponse" }
|
|
1646
|
+
},
|
|
1647
|
+
{
|
|
1648
|
+
method: "get",
|
|
1649
|
+
path: "/indexes/:name/documents/:id",
|
|
1650
|
+
handler: "get",
|
|
1651
|
+
options: document,
|
|
1652
|
+
operationId: "get",
|
|
1653
|
+
summary: "Read one document",
|
|
1654
|
+
tags: ["Documents"],
|
|
1655
|
+
request: null,
|
|
1656
|
+
responses: { 200: "DocumentResponse" }
|
|
1657
|
+
},
|
|
1658
|
+
{
|
|
1659
|
+
method: "get",
|
|
1660
|
+
path: "/indexes/:name/documents/:id/_exists",
|
|
1661
|
+
handler: "exists",
|
|
1662
|
+
options: document,
|
|
1663
|
+
operationId: "has",
|
|
1664
|
+
summary: "Report whether an index holds a document with the id",
|
|
1665
|
+
tags: ["Documents"],
|
|
1666
|
+
request: null,
|
|
1667
|
+
responses: { 200: "DocumentExistsResponse" }
|
|
1668
|
+
},
|
|
1669
|
+
{
|
|
1670
|
+
method: "put",
|
|
1671
|
+
path: "/indexes/:name/documents/:id",
|
|
1672
|
+
handler: "put",
|
|
1673
|
+
options: documentWriteBody,
|
|
1674
|
+
operationId: "put",
|
|
1675
|
+
summary: "Write one document under the id, whether or not the id exists",
|
|
1676
|
+
tags: ["Documents"],
|
|
1677
|
+
request: "DocumentBody",
|
|
1678
|
+
responses: { 200: "DocumentPutResponse", 201: "DocumentPutResponse" }
|
|
1679
|
+
},
|
|
1680
|
+
{
|
|
1681
|
+
method: "patch",
|
|
1682
|
+
path: "/indexes/:name/documents/:id",
|
|
1683
|
+
handler: "patch",
|
|
1684
|
+
options: documentWriteBody,
|
|
1685
|
+
operationId: "update",
|
|
1686
|
+
summary: "Update one existing document",
|
|
1687
|
+
tags: ["Documents"],
|
|
1688
|
+
request: "DocumentBody",
|
|
1689
|
+
responses: { 200: "DocumentIdResponse" }
|
|
1690
|
+
},
|
|
1691
|
+
{
|
|
1692
|
+
method: "del",
|
|
1693
|
+
path: "/indexes/:name/documents/:id",
|
|
1694
|
+
handler: "remove",
|
|
1695
|
+
options: document,
|
|
1696
|
+
operationId: "remove",
|
|
1697
|
+
summary: "Remove one document",
|
|
1698
|
+
tags: ["Documents"],
|
|
1699
|
+
request: null,
|
|
1700
|
+
query: "RemoveDocumentQuery",
|
|
1701
|
+
responses: { 200: "DocumentRemovedResponse" }
|
|
1702
|
+
}
|
|
1703
|
+
];
|
|
1704
|
+
}
|
|
1705
|
+
function searchRoutes(shared) {
|
|
1706
|
+
const { readBody: readBody2 } = shared;
|
|
1707
|
+
return [
|
|
1708
|
+
{
|
|
1709
|
+
method: "post",
|
|
1710
|
+
path: "/indexes/:name/search",
|
|
1711
|
+
handler: "search",
|
|
1712
|
+
options: readBody2,
|
|
1713
|
+
operationId: "query",
|
|
1714
|
+
summary: "Search an index",
|
|
1715
|
+
tags: ["Search"],
|
|
1716
|
+
request: "HttpQueryParams",
|
|
1717
|
+
responses: { 200: "HttpQueryResult" },
|
|
1718
|
+
repeatable: true
|
|
1719
|
+
},
|
|
1720
|
+
{
|
|
1721
|
+
method: "post",
|
|
1722
|
+
path: "/indexes/:name/search/preflight",
|
|
1723
|
+
handler: "preflight",
|
|
1724
|
+
options: readBody2,
|
|
1725
|
+
operationId: "preflight",
|
|
1726
|
+
summary: "Count the documents that a search matches, with no hits",
|
|
1727
|
+
tags: ["Search"],
|
|
1728
|
+
request: "HttpQueryParams",
|
|
1729
|
+
responses: { 200: "PreflightResult" },
|
|
1730
|
+
repeatable: true
|
|
1731
|
+
},
|
|
1732
|
+
{
|
|
1733
|
+
method: "post",
|
|
1734
|
+
path: "/indexes/:name/suggest",
|
|
1735
|
+
handler: "suggest",
|
|
1736
|
+
options: readBody2,
|
|
1737
|
+
operationId: "suggest",
|
|
1738
|
+
summary: "Complete a prefix from the terms of an index",
|
|
1739
|
+
tags: ["Search"],
|
|
1740
|
+
request: "SuggestParams",
|
|
1741
|
+
responses: { 200: "SuggestResult" },
|
|
1742
|
+
repeatable: true
|
|
1743
|
+
}
|
|
1744
|
+
];
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
// src/server/routes/indexes.ts
|
|
1748
|
+
function indexRoutes(shared) {
|
|
1749
|
+
const { bare, named, namedBody, newIndexBody } = shared;
|
|
1750
|
+
return [
|
|
1751
|
+
{
|
|
1752
|
+
method: "post",
|
|
1753
|
+
path: "/indexes",
|
|
1754
|
+
handler: "createIndex",
|
|
1755
|
+
options: newIndexBody,
|
|
1756
|
+
operationId: "createIndex",
|
|
1757
|
+
summary: "Create an index",
|
|
1758
|
+
tags: ["Indexes"],
|
|
1759
|
+
request: "HttpCreateIndexBody",
|
|
1760
|
+
responses: { 201: "IndexCreatedResponse" }
|
|
1761
|
+
},
|
|
1762
|
+
{
|
|
1763
|
+
method: "get",
|
|
1764
|
+
path: "/indexes",
|
|
1765
|
+
handler: "listIndexes",
|
|
1766
|
+
options: bare,
|
|
1767
|
+
operationId: "listIndexes",
|
|
1768
|
+
summary: "List every index",
|
|
1769
|
+
tags: ["Indexes"],
|
|
1770
|
+
request: null,
|
|
1771
|
+
responses: { 200: "IndexListResponse" }
|
|
1772
|
+
},
|
|
1773
|
+
{
|
|
1774
|
+
method: "del",
|
|
1775
|
+
path: "/indexes/:name",
|
|
1776
|
+
handler: "dropIndex",
|
|
1777
|
+
options: named,
|
|
1778
|
+
operationId: "dropIndex",
|
|
1779
|
+
summary: "Drop an index",
|
|
1780
|
+
tags: ["Indexes"],
|
|
1781
|
+
request: null,
|
|
1782
|
+
responses: { 200: "IndexDroppedResponse" }
|
|
1783
|
+
},
|
|
1784
|
+
{
|
|
1785
|
+
method: "get",
|
|
1786
|
+
path: "/indexes/:name/stats",
|
|
1787
|
+
handler: "indexStats",
|
|
1788
|
+
options: named,
|
|
1789
|
+
operationId: "getStats",
|
|
1790
|
+
summary: "Report the statistics of an index",
|
|
1791
|
+
tags: ["Indexes"],
|
|
1792
|
+
request: null,
|
|
1793
|
+
responses: { 200: "IndexStats" }
|
|
1794
|
+
},
|
|
1795
|
+
{
|
|
1796
|
+
method: "get",
|
|
1797
|
+
path: "/indexes/:name/partitions",
|
|
1798
|
+
handler: "indexPartitions",
|
|
1799
|
+
options: named,
|
|
1800
|
+
operationId: "getPartitionStats",
|
|
1801
|
+
summary: "Report the statistics of each partition of an index",
|
|
1802
|
+
tags: ["Indexes"],
|
|
1803
|
+
request: null,
|
|
1804
|
+
responses: { 200: "IndexPartitionsResponse" }
|
|
1805
|
+
},
|
|
1806
|
+
{
|
|
1807
|
+
method: "get",
|
|
1808
|
+
path: "/indexes/:name/cluster",
|
|
1809
|
+
handler: "clusterAllocation",
|
|
1810
|
+
options: named,
|
|
1811
|
+
operationId: "getIndexAllocation",
|
|
1812
|
+
summary: "Report how the cluster has placed the partitions of an index",
|
|
1813
|
+
tags: ["Cluster"],
|
|
1814
|
+
request: null,
|
|
1815
|
+
responses: { 200: "ClusterAllocationResponse" }
|
|
1816
|
+
},
|
|
1817
|
+
{
|
|
1818
|
+
method: "put",
|
|
1819
|
+
path: "/indexes/:name/replication-factor",
|
|
1820
|
+
handler: "clusterReplicationFactor",
|
|
1821
|
+
options: namedBody,
|
|
1822
|
+
operationId: "setReplicationFactor",
|
|
1823
|
+
summary: "Change how many replicas each partition of an index keeps",
|
|
1824
|
+
tags: ["Cluster"],
|
|
1825
|
+
request: "ReplicationFactorBody",
|
|
1826
|
+
responses: { 200: "ReplicationFactorResponse" }
|
|
1827
|
+
},
|
|
1828
|
+
{
|
|
1829
|
+
method: "post",
|
|
1830
|
+
path: "/indexes/:name/_clear",
|
|
1831
|
+
handler: "clearIndex",
|
|
1832
|
+
options: named,
|
|
1833
|
+
operationId: "clear",
|
|
1834
|
+
summary: "Remove every document and keep the index",
|
|
1835
|
+
tags: ["Indexes"],
|
|
1836
|
+
request: null,
|
|
1837
|
+
responses: { 200: "IndexClearedResponse" }
|
|
1838
|
+
},
|
|
1839
|
+
{
|
|
1840
|
+
method: "post",
|
|
1841
|
+
path: "/indexes/:name/_open",
|
|
1842
|
+
handler: "openIndex",
|
|
1843
|
+
options: named,
|
|
1844
|
+
operationId: "open",
|
|
1845
|
+
summary: "Load an index into memory",
|
|
1846
|
+
tags: ["Indexes"],
|
|
1847
|
+
request: null,
|
|
1848
|
+
responses: { 200: "IndexStateResponse" }
|
|
1849
|
+
},
|
|
1850
|
+
{
|
|
1851
|
+
method: "post",
|
|
1852
|
+
path: "/indexes/:name/_close",
|
|
1853
|
+
handler: "closeIndex",
|
|
1854
|
+
options: named,
|
|
1855
|
+
operationId: "close",
|
|
1856
|
+
summary: "Release the memory of an index",
|
|
1857
|
+
tags: ["Indexes"],
|
|
1858
|
+
request: null,
|
|
1859
|
+
responses: { 200: "IndexStateResponse" }
|
|
1860
|
+
},
|
|
1861
|
+
{
|
|
1862
|
+
method: "get",
|
|
1863
|
+
path: "/indexes/:name/count",
|
|
1864
|
+
handler: "count",
|
|
1865
|
+
options: named,
|
|
1866
|
+
operationId: "countDocuments",
|
|
1867
|
+
summary: "Count the documents in an index",
|
|
1868
|
+
tags: ["Indexes"],
|
|
1869
|
+
request: null,
|
|
1870
|
+
responses: { 200: "DocumentCountResponse" }
|
|
1871
|
+
}
|
|
1872
|
+
];
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
// src/server/routes/info.ts
|
|
1876
|
+
function infoRoutes(shared) {
|
|
1877
|
+
const { probe, bare, named } = shared;
|
|
1878
|
+
return [
|
|
1879
|
+
{
|
|
1880
|
+
method: "get",
|
|
1881
|
+
path: "/livez",
|
|
1882
|
+
handler: "livez",
|
|
1883
|
+
options: probe,
|
|
1884
|
+
operationId: "isAlive",
|
|
1885
|
+
summary: "Report that the process can serve HTTP",
|
|
1886
|
+
tags: ["Server"],
|
|
1887
|
+
request: null,
|
|
1888
|
+
responses: { 200: "LivenessResponse" }
|
|
1889
|
+
},
|
|
1890
|
+
{
|
|
1891
|
+
method: "get",
|
|
1892
|
+
path: "/readyz",
|
|
1893
|
+
handler: "readyz",
|
|
1894
|
+
options: probe,
|
|
1895
|
+
operationId: "isReady",
|
|
1896
|
+
summary: "Report whether the server can take requests",
|
|
1897
|
+
tags: ["Server"],
|
|
1898
|
+
request: null,
|
|
1899
|
+
responses: { 200: "ReadinessResponse", 503: "ReadinessResponse" }
|
|
1900
|
+
},
|
|
1901
|
+
{
|
|
1902
|
+
method: "get",
|
|
1903
|
+
path: "/health",
|
|
1904
|
+
handler: "readyz",
|
|
1905
|
+
options: probe,
|
|
1906
|
+
operationId: "health",
|
|
1907
|
+
summary: "Report whether the server can take requests, as /readyz does",
|
|
1908
|
+
tags: ["Server"],
|
|
1909
|
+
request: null,
|
|
1910
|
+
responses: { 200: "ReadinessResponse", 503: "ReadinessResponse" }
|
|
1911
|
+
},
|
|
1912
|
+
{
|
|
1913
|
+
method: "get",
|
|
1914
|
+
path: "/version",
|
|
1915
|
+
handler: "version",
|
|
1916
|
+
options: probe,
|
|
1917
|
+
operationId: "version",
|
|
1918
|
+
summary: "Report the build identity of the server",
|
|
1919
|
+
tags: ["Server"],
|
|
1920
|
+
request: null,
|
|
1921
|
+
responses: { 200: "VersionResponse" }
|
|
1922
|
+
},
|
|
1923
|
+
{
|
|
1924
|
+
method: "get",
|
|
1925
|
+
path: "/capabilities",
|
|
1926
|
+
handler: "capabilities",
|
|
1927
|
+
options: probe,
|
|
1928
|
+
operationId: "capabilities",
|
|
1929
|
+
summary: "List the optional routes and modes that this server serves",
|
|
1930
|
+
tags: ["Server"],
|
|
1931
|
+
request: null,
|
|
1932
|
+
responses: { 200: "CapabilitiesResponse" }
|
|
1933
|
+
},
|
|
1934
|
+
{
|
|
1935
|
+
method: "get",
|
|
1936
|
+
path: "/cluster",
|
|
1937
|
+
handler: "clusterTopology",
|
|
1938
|
+
options: bare,
|
|
1939
|
+
operationId: "getClusterTopology",
|
|
1940
|
+
summary: "Report the nodes of the cluster and the controller",
|
|
1941
|
+
tags: ["Cluster"],
|
|
1942
|
+
request: null,
|
|
1943
|
+
responses: { 200: "ClusterTopologyResponse" }
|
|
1944
|
+
},
|
|
1945
|
+
{
|
|
1946
|
+
method: "get",
|
|
1947
|
+
path: "/cluster/health",
|
|
1948
|
+
handler: "clusterHealth",
|
|
1949
|
+
options: bare,
|
|
1950
|
+
operationId: "getClusterHealth",
|
|
1951
|
+
summary: "Report a green, yellow, or red status for the cluster and each index",
|
|
1952
|
+
tags: ["Cluster"],
|
|
1953
|
+
request: null,
|
|
1954
|
+
responses: { 200: "ClusterHealth" }
|
|
1955
|
+
},
|
|
1956
|
+
{
|
|
1957
|
+
method: "get",
|
|
1958
|
+
path: "/metrics",
|
|
1959
|
+
handler: "metrics",
|
|
1960
|
+
options: bare,
|
|
1961
|
+
operationId: "getMetrics",
|
|
1962
|
+
summary: "Report the replication and coordinator figures in the Prometheus text format",
|
|
1963
|
+
tags: ["Cluster"],
|
|
1964
|
+
request: null,
|
|
1965
|
+
responses: { 200: { contentType: PROMETHEUS_TEXT_CONTENT_TYPE } }
|
|
1966
|
+
},
|
|
1967
|
+
{
|
|
1968
|
+
method: "get",
|
|
1969
|
+
path: "/stats/memory",
|
|
1970
|
+
handler: "memory",
|
|
1971
|
+
options: bare,
|
|
1972
|
+
operationId: "getMemoryStats",
|
|
1973
|
+
summary: "Report the memory that the engine and the server use",
|
|
1974
|
+
tags: ["Server"],
|
|
1975
|
+
request: null,
|
|
1976
|
+
responses: { 200: "MemoryStatsResponse" }
|
|
1977
|
+
},
|
|
1978
|
+
{
|
|
1979
|
+
method: "get",
|
|
1980
|
+
path: "/tasks",
|
|
1981
|
+
handler: "listTasks",
|
|
1982
|
+
options: bare,
|
|
1983
|
+
operationId: "listTasks",
|
|
1984
|
+
summary: "List task records, newest first",
|
|
1985
|
+
tags: ["Tasks"],
|
|
1986
|
+
request: null,
|
|
1987
|
+
query: "TaskListQuery",
|
|
1988
|
+
responses: { 200: "TaskListPage" }
|
|
1989
|
+
},
|
|
1990
|
+
{
|
|
1991
|
+
method: "get",
|
|
1992
|
+
path: "/tasks/:id",
|
|
1993
|
+
handler: "getTask",
|
|
1994
|
+
options: named,
|
|
1995
|
+
operationId: "getTask",
|
|
1996
|
+
summary: "Read one task record",
|
|
1997
|
+
tags: ["Tasks"],
|
|
1998
|
+
request: null,
|
|
1999
|
+
responses: { 200: "TaskRecord" }
|
|
2000
|
+
},
|
|
2001
|
+
{
|
|
2002
|
+
method: "post",
|
|
2003
|
+
path: "/tasks/:id/_cancel",
|
|
2004
|
+
handler: "cancelTask",
|
|
2005
|
+
options: named,
|
|
2006
|
+
operationId: "cancelTask",
|
|
2007
|
+
summary: "Ask a running task to stop",
|
|
2008
|
+
tags: ["Tasks"],
|
|
2009
|
+
request: null,
|
|
2010
|
+
responses: { 202: "TaskRecord" }
|
|
2011
|
+
}
|
|
2012
|
+
];
|
|
2013
|
+
}
|
|
2014
|
+
|
|
2015
|
+
// src/server/routes/maintenance.ts
|
|
2016
|
+
function maintenanceRoutes(shared) {
|
|
2017
|
+
const { named, namedBody, spooledBody } = shared;
|
|
2018
|
+
return [
|
|
2019
|
+
{
|
|
2020
|
+
method: "post",
|
|
2021
|
+
path: "/indexes/:name/_checkpoint",
|
|
2022
|
+
handler: "checkpoint",
|
|
2023
|
+
options: named,
|
|
2024
|
+
operationId: "checkpoint",
|
|
2025
|
+
summary: "Force a checkpoint of an index",
|
|
2026
|
+
tags: ["Maintenance"],
|
|
2027
|
+
request: null,
|
|
2028
|
+
responses: { 200: "OkResponse" }
|
|
2029
|
+
},
|
|
2030
|
+
{
|
|
2031
|
+
method: "post",
|
|
2032
|
+
path: "/indexes/:name/_rebuild-analysis",
|
|
2033
|
+
handler: "rebuildAnalysis",
|
|
2034
|
+
options: named,
|
|
2035
|
+
operationId: "rebuildAnalysis",
|
|
2036
|
+
summary: "Reanalyse every document of an index, as a task",
|
|
2037
|
+
tags: ["Maintenance"],
|
|
2038
|
+
request: null,
|
|
2039
|
+
responses: { 202: "TaskRecord" }
|
|
2040
|
+
},
|
|
2041
|
+
{
|
|
2042
|
+
method: "post",
|
|
2043
|
+
path: "/indexes/:name/_change-analysis",
|
|
2044
|
+
handler: "changeAnalysis",
|
|
2045
|
+
options: namedBody,
|
|
2046
|
+
operationId: "changeAnalysis",
|
|
2047
|
+
summary: "Change the language, stop words, or tokeniser of an index, as a task",
|
|
2048
|
+
tags: ["Maintenance"],
|
|
2049
|
+
request: { optional: "ChangeAnalysisBody" },
|
|
2050
|
+
responses: { 202: "TaskRecord" }
|
|
2051
|
+
},
|
|
2052
|
+
{
|
|
2053
|
+
method: "get",
|
|
2054
|
+
path: "/indexes/:name/snapshot",
|
|
2055
|
+
handler: "snapshot",
|
|
2056
|
+
options: named,
|
|
2057
|
+
operationId: "snapshot",
|
|
2058
|
+
summary: "Stream a snapshot archive of an index",
|
|
2059
|
+
tags: ["Maintenance"],
|
|
2060
|
+
request: null,
|
|
2061
|
+
responses: { 200: { contentType: SNAPSHOT_ARCHIVE_CONTENT_TYPE } }
|
|
2062
|
+
},
|
|
2063
|
+
{
|
|
2064
|
+
method: "get",
|
|
2065
|
+
path: "/indexes/:name/vector-maintenance",
|
|
2066
|
+
handler: "vectorMaintenance",
|
|
2067
|
+
options: named,
|
|
2068
|
+
operationId: "vectorMaintenanceStatus",
|
|
2069
|
+
summary: "Report the state of each vector field of an index",
|
|
2070
|
+
tags: ["Maintenance"],
|
|
2071
|
+
request: null,
|
|
2072
|
+
responses: { 200: "VectorMaintenanceResponse" }
|
|
2073
|
+
},
|
|
2074
|
+
{
|
|
2075
|
+
method: "post",
|
|
2076
|
+
path: "/indexes/:name/vectors/_compact",
|
|
2077
|
+
handler: "compact",
|
|
2078
|
+
options: namedBody,
|
|
2079
|
+
operationId: "compactVectors",
|
|
2080
|
+
summary: "Compact the vector fields of an index",
|
|
2081
|
+
tags: ["Maintenance"],
|
|
2082
|
+
request: { optional: "VectorFieldBody" },
|
|
2083
|
+
responses: { 200: "OkResponse" }
|
|
2084
|
+
},
|
|
2085
|
+
{
|
|
2086
|
+
method: "post",
|
|
2087
|
+
path: "/indexes/:name/vectors/_optimize",
|
|
2088
|
+
handler: "optimize",
|
|
2089
|
+
options: namedBody,
|
|
2090
|
+
operationId: "optimizeVectors",
|
|
2091
|
+
summary: "Rebuild the vector graphs of an index, as a task",
|
|
2092
|
+
tags: ["Maintenance"],
|
|
2093
|
+
request: { optional: "VectorFieldBody" },
|
|
2094
|
+
responses: { 202: "TaskRecord" }
|
|
2095
|
+
},
|
|
2096
|
+
{
|
|
2097
|
+
method: "post",
|
|
2098
|
+
path: "/indexes/:name/_rebalance",
|
|
2099
|
+
handler: "rebalance",
|
|
2100
|
+
options: namedBody,
|
|
2101
|
+
operationId: "rebalance",
|
|
2102
|
+
summary: "Move an index to another partition count, as a task",
|
|
2103
|
+
tags: ["Maintenance"],
|
|
2104
|
+
request: "RebalanceBody",
|
|
2105
|
+
responses: { 202: "TaskRecord" }
|
|
2106
|
+
},
|
|
2107
|
+
{
|
|
2108
|
+
method: "post",
|
|
2109
|
+
path: "/indexes/:name/partition-config",
|
|
2110
|
+
handler: "partitionConfig",
|
|
2111
|
+
options: namedBody,
|
|
2112
|
+
operationId: "updatePartitionConfig",
|
|
2113
|
+
summary: "Change the partition settings of an index",
|
|
2114
|
+
tags: ["Maintenance"],
|
|
2115
|
+
request: { optional: "PartitionConfig" },
|
|
2116
|
+
responses: { 200: "OkResponse" }
|
|
2117
|
+
},
|
|
2118
|
+
{
|
|
2119
|
+
method: "get",
|
|
2120
|
+
path: "/indexes/:name/synonyms",
|
|
2121
|
+
handler: "readSynonyms",
|
|
2122
|
+
options: named,
|
|
2123
|
+
operationId: "getSynonyms",
|
|
2124
|
+
summary: "Read the synonym set of an index",
|
|
2125
|
+
tags: ["Maintenance"],
|
|
2126
|
+
request: null,
|
|
2127
|
+
responses: { 200: "SynonymSetBody" }
|
|
2128
|
+
},
|
|
2129
|
+
{
|
|
2130
|
+
method: "post",
|
|
2131
|
+
path: "/indexes/:name/synonyms",
|
|
2132
|
+
handler: "replaceSynonyms",
|
|
2133
|
+
options: namedBody,
|
|
2134
|
+
operationId: "updateSynonyms",
|
|
2135
|
+
summary: "Replace the synonym set of an index",
|
|
2136
|
+
tags: ["Maintenance"],
|
|
2137
|
+
request: "SynonymSetBody",
|
|
2138
|
+
responses: { 200: "OkResponse" }
|
|
2139
|
+
},
|
|
2140
|
+
{
|
|
2141
|
+
method: "post",
|
|
2142
|
+
path: "/indexes/:name/bm25",
|
|
2143
|
+
handler: "updateBm25",
|
|
2144
|
+
options: namedBody,
|
|
2145
|
+
operationId: "updateBM25",
|
|
2146
|
+
summary: "Replace the BM25 setting of an index",
|
|
2147
|
+
tags: ["Maintenance"],
|
|
2148
|
+
request: "BM25Params",
|
|
2149
|
+
responses: { 200: "OkResponse" }
|
|
2150
|
+
},
|
|
2151
|
+
{
|
|
2152
|
+
method: "post",
|
|
2153
|
+
path: "/indexes/:name/restore",
|
|
2154
|
+
handler: "restore",
|
|
2155
|
+
options: spooledBody,
|
|
2156
|
+
operationId: "restore",
|
|
2157
|
+
summary: "Restore an index from a snapshot archive, as a task",
|
|
2158
|
+
tags: ["Maintenance"],
|
|
2159
|
+
request: { contentType: SNAPSHOT_ARCHIVE_CONTENT_TYPE },
|
|
2160
|
+
responses: { 202: "TaskRecord" }
|
|
2161
|
+
},
|
|
2162
|
+
{
|
|
2163
|
+
method: "get",
|
|
2164
|
+
path: "/indexes/:name/export",
|
|
2165
|
+
handler: "exportDocuments",
|
|
2166
|
+
options: named,
|
|
2167
|
+
operationId: "exportDocuments",
|
|
2168
|
+
summary: "Stream a document export of an index",
|
|
2169
|
+
tags: ["Maintenance"],
|
|
2170
|
+
request: null,
|
|
2171
|
+
responses: { 200: { contentType: DOCUMENT_EXPORT_CONTENT_TYPE } }
|
|
2172
|
+
},
|
|
2173
|
+
{
|
|
2174
|
+
method: "post",
|
|
2175
|
+
path: "/indexes/:name/import",
|
|
2176
|
+
handler: "importExport",
|
|
2177
|
+
options: spooledBody,
|
|
2178
|
+
operationId: "importDocumentExport",
|
|
2179
|
+
summary: "Import a document export, as a task",
|
|
2180
|
+
tags: ["Maintenance"],
|
|
2181
|
+
request: { contentType: DOCUMENT_EXPORT_CONTENT_TYPE },
|
|
2182
|
+
responses: { 202: "TaskRecord" }
|
|
2183
|
+
}
|
|
2184
|
+
];
|
|
2185
|
+
}
|
|
2186
|
+
|
|
1545
2187
|
// src/server/batch-scan.ts
|
|
1546
2188
|
var QUOTE2 = 34;
|
|
1547
2189
|
var BACKSLASH2 = 92;
|
|
@@ -1632,99 +2274,42 @@ function batchBodyKindOf(prefix) {
|
|
|
1632
2274
|
return prefix.length > BATCH_KIND_SCAN_BYTES ? "read" : null;
|
|
1633
2275
|
}
|
|
1634
2276
|
|
|
1635
|
-
// src/server/routes.ts
|
|
2277
|
+
// src/server/routes/options.ts
|
|
1636
2278
|
var writeBodyKind = () => "write";
|
|
1637
2279
|
var readBodyKind = () => "read";
|
|
1638
|
-
function
|
|
1639
|
-
const { maxBodyBytes, maxImportBytes } = limits;
|
|
1640
|
-
const probe = { maxBytes: 0, skipHooks: true };
|
|
1641
|
-
const bare = { maxBytes: 0 };
|
|
1642
|
-
const named = { paramCount: 1, maxBytes: 0 };
|
|
2280
|
+
function sharedRouteOptions(limits) {
|
|
2281
|
+
const { maxBodyBytes, maxImportBytes, maxRestoreBytes } = limits;
|
|
1643
2282
|
const namedBody = { paramCount: 1, needsBody: true, maxBytes: maxBodyBytes };
|
|
1644
|
-
const document = { paramCount: 2, maxBytes: 0 };
|
|
1645
2283
|
const documentBody = { paramCount: 2, needsBody: true, maxBytes: maxBodyBytes };
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
2284
|
+
return {
|
|
2285
|
+
probe: { maxBytes: 0, skipHooks: true },
|
|
2286
|
+
bare: { maxBytes: 0 },
|
|
2287
|
+
named: { paramCount: 1, maxBytes: 0 },
|
|
2288
|
+
namedBody,
|
|
2289
|
+
document: { paramCount: 2, maxBytes: 0 },
|
|
2290
|
+
writeBody: { ...namedBody, bodyKind: writeBodyKind },
|
|
2291
|
+
readBody: { ...namedBody, bodyKind: readBodyKind },
|
|
2292
|
+
batchBody: { ...namedBody, bodyKind: batchBodyKindOf },
|
|
2293
|
+
documentWriteBody: { ...documentBody, bodyKind: writeBodyKind },
|
|
2294
|
+
importBody: { paramCount: 1, needsBody: true, maxBytes: maxImportBytes },
|
|
2295
|
+
spooledBody: { paramCount: 1, spoolsBody: true, maxBytes: maxRestoreBytes },
|
|
2296
|
+
newIndexBody: { needsBody: true, maxBytes: maxBodyBytes }
|
|
2297
|
+
};
|
|
2298
|
+
}
|
|
2299
|
+
|
|
2300
|
+
// src/server/routes/table.ts
|
|
2301
|
+
function serverRoutes(limits) {
|
|
2302
|
+
const shared = sharedRouteOptions(limits);
|
|
1649
2303
|
return [
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
{ method: "get", path: "/cluster", handler: "clusterTopology", options: bare },
|
|
1656
|
-
{ method: "get", path: "/cluster/health", handler: "clusterHealth", options: bare },
|
|
1657
|
-
{ method: "get", path: "/metrics", handler: "metrics", options: bare },
|
|
1658
|
-
{ method: "get", path: "/stats/memory", handler: "memory", options: bare },
|
|
1659
|
-
{ method: "get", path: "/tasks", handler: "listTasks", options: bare },
|
|
1660
|
-
{ method: "get", path: "/tasks/:id", handler: "getTask", options: named },
|
|
1661
|
-
{ method: "post", path: "/tasks/:id/_cancel", handler: "cancelTask", options: named },
|
|
1662
|
-
{ method: "post", path: "/indexes", handler: "createIndex", options: { needsBody: true, maxBytes: maxBodyBytes } },
|
|
1663
|
-
{ method: "get", path: "/indexes", handler: "listIndexes", options: bare },
|
|
1664
|
-
{ method: "del", path: "/indexes/:name", handler: "dropIndex", options: named },
|
|
1665
|
-
{ method: "get", path: "/indexes/:name/stats", handler: "indexStats", options: named },
|
|
1666
|
-
{ method: "get", path: "/indexes/:name/partitions", handler: "indexPartitions", options: named },
|
|
1667
|
-
{ method: "get", path: "/indexes/:name/cluster", handler: "clusterAllocation", options: named },
|
|
1668
|
-
{
|
|
1669
|
-
method: "put",
|
|
1670
|
-
path: "/indexes/:name/replication-factor",
|
|
1671
|
-
handler: "clusterReplicationFactor",
|
|
1672
|
-
options: namedBody
|
|
1673
|
-
},
|
|
1674
|
-
{ method: "post", path: "/indexes/:name/_clear", handler: "clearIndex", options: named },
|
|
1675
|
-
{ method: "post", path: "/indexes/:name/_open", handler: "openIndex", options: named },
|
|
1676
|
-
{ method: "post", path: "/indexes/:name/_close", handler: "closeIndex", options: named },
|
|
1677
|
-
{ method: "get", path: "/indexes/:name/count", handler: "count", options: named },
|
|
1678
|
-
{ method: "post", path: "/indexes/:name/documents", handler: "insert", options: writeBody },
|
|
1679
|
-
{
|
|
1680
|
-
method: "post",
|
|
1681
|
-
path: "/indexes/:name/documents/_batch",
|
|
1682
|
-
handler: "batch",
|
|
1683
|
-
options: { ...namedBody, bodyKind: batchBodyKindOf }
|
|
1684
|
-
},
|
|
1685
|
-
{ method: "post", path: "/indexes/:name/documents/_list", handler: "list", options: readBody2 },
|
|
1686
|
-
{ method: "post", path: "/indexes/:name/documents/_multi-get", handler: "multiGet", options: readBody2 },
|
|
1687
|
-
{
|
|
1688
|
-
method: "post",
|
|
1689
|
-
path: "/indexes/:name/documents/_import",
|
|
1690
|
-
handler: "importNdjson",
|
|
1691
|
-
options: { paramCount: 1, needsBody: true, maxBytes: maxImportBytes }
|
|
1692
|
-
},
|
|
1693
|
-
{ method: "post", path: "/indexes/:name/_wait-for-writes", handler: "waitForWrites", options: named },
|
|
1694
|
-
{ method: "get", path: "/indexes/:name/documents/:id", handler: "get", options: document },
|
|
1695
|
-
{ method: "get", path: "/indexes/:name/documents/:id/_exists", handler: "exists", options: document },
|
|
1696
|
-
{ method: "put", path: "/indexes/:name/documents/:id", handler: "put", options: documentWriteBody },
|
|
1697
|
-
{ method: "patch", path: "/indexes/:name/documents/:id", handler: "patch", options: documentWriteBody },
|
|
1698
|
-
{ method: "del", path: "/indexes/:name/documents/:id", handler: "remove", options: document },
|
|
1699
|
-
{ method: "post", path: "/indexes/:name/search", handler: "search", options: readBody2 },
|
|
1700
|
-
{ method: "post", path: "/indexes/:name/search/preflight", handler: "preflight", options: readBody2 },
|
|
1701
|
-
{ method: "post", path: "/indexes/:name/suggest", handler: "suggest", options: readBody2 },
|
|
1702
|
-
{ method: "post", path: "/indexes/:name/_checkpoint", handler: "checkpoint", options: named },
|
|
1703
|
-
{ method: "post", path: "/indexes/:name/_rebuild-analysis", handler: "rebuildAnalysis", options: named },
|
|
1704
|
-
{ method: "get", path: "/indexes/:name/snapshot", handler: "snapshot", options: named },
|
|
1705
|
-
{ method: "get", path: "/indexes/:name/vector-maintenance", handler: "vectorMaintenance", options: named },
|
|
1706
|
-
{ method: "post", path: "/indexes/:name/vectors/_compact", handler: "compact", options: namedBody },
|
|
1707
|
-
{ method: "post", path: "/indexes/:name/vectors/_optimize", handler: "optimize", options: namedBody },
|
|
1708
|
-
{ method: "post", path: "/indexes/:name/_rebalance", handler: "rebalance", options: namedBody },
|
|
1709
|
-
{ method: "post", path: "/indexes/:name/partition-config", handler: "partitionConfig", options: namedBody },
|
|
1710
|
-
{ method: "get", path: "/indexes/:name/synonyms", handler: "readSynonyms", options: named },
|
|
1711
|
-
{ method: "post", path: "/indexes/:name/synonyms", handler: "replaceSynonyms", options: namedBody },
|
|
1712
|
-
{ method: "post", path: "/indexes/:name/bm25", handler: "updateBm25", options: namedBody },
|
|
1713
|
-
{
|
|
1714
|
-
method: "post",
|
|
1715
|
-
path: "/indexes/:name/restore",
|
|
1716
|
-
handler: "restore",
|
|
1717
|
-
options: { paramCount: 1, spoolsBody: true, maxBytes: limits.maxRestoreBytes }
|
|
1718
|
-
},
|
|
1719
|
-
{ method: "get", path: "/indexes/:name/export", handler: "exportDocuments", options: named },
|
|
1720
|
-
{
|
|
1721
|
-
method: "post",
|
|
1722
|
-
path: "/indexes/:name/import",
|
|
1723
|
-
handler: "importExport",
|
|
1724
|
-
options: { paramCount: 1, spoolsBody: true, maxBytes: limits.maxRestoreBytes }
|
|
1725
|
-
}
|
|
2304
|
+
...infoRoutes(shared),
|
|
2305
|
+
...indexRoutes(shared),
|
|
2306
|
+
...documentRoutes(shared),
|
|
2307
|
+
...searchRoutes(shared),
|
|
2308
|
+
...maintenanceRoutes(shared)
|
|
1726
2309
|
];
|
|
1727
2310
|
}
|
|
2311
|
+
|
|
2312
|
+
// src/server/routes/register.ts
|
|
1728
2313
|
function registerServerRoutes(app, run, handlers, limits, cors) {
|
|
1729
2314
|
if (cors) {
|
|
1730
2315
|
app.options("/*", (res, req) => {
|
|
@@ -1836,4 +2421,4 @@ async function departureConfirmation(word) {
|
|
|
1836
2421
|
if (waiting.async) await waiting.value;
|
|
1837
2422
|
}
|
|
1838
2423
|
|
|
1839
|
-
export { ASYNC_IMPORT_CAPABILITY, BM25_TUNING_CAPABILITY, DEFAULT_IMPORT_BATCH_SIZE, DEFAULT_MAX_BODY_BYTES, DEFAULT_MAX_BODY_BYTES_IN_FLIGHT_FRACTION, DEFAULT_MAX_CONCURRENT_REQUESTS, DEFAULT_MAX_CONCURRENT_TASKS, DEFAULT_MAX_FETCH_DOCUMENTS, DEFAULT_MAX_IMPORT_BYTES, DEFAULT_MAX_IMPORT_ERRORS, DEFAULT_MAX_LINE_BYTES, DEFAULT_MAX_RERANK_WINDOW, DEFAULT_MAX_RESTORE_BYTES, DEFAULT_MAX_RESULT_WINDOW, DEFAULT_MAX_RETAINED_TASKS, DEFAULT_MAX_TASK_PAGE_SIZE, DEFAULT_TASK_PAGE_SIZE, DOCUMENT_EXPORT_CAPABILITY, DOCUMENT_EXPORT_CONTENT_TYPE, IMPORT_FLUSHES_IN_FLIGHT, INDEX_LIFECYCLE_CAPABILITY, INDEX_TOUCH_INTERVALS_PER_IDLE_TIMEOUT, MAIN_THREAD_GATE_SLOT, MAX_BODY_BYTES_IN_FLIGHT_FRACTION, MAX_INDEX_TOUCH_INTERVAL_MS, MAX_LONG_QUERIES_IN_FLIGHT, MIN_COUNTED_SERVER_LIMIT, MIN_UNBOUNDED_SERVER_LIMIT, REBUILD_ANALYSIS_CAPABILITY, RELAY_STREAM_CHUNKS_IN_FLIGHT, REQUEST_THREAD_CLOSE_AT_EXIT_MS, REQUEST_THREAD_DEPARTURE_DRAIN_MS, REQUEST_THREAD_MOVE_AFTER_MS, RUNNING_TASK_TTL_MS, SEARCH_CLOCK_SAMPLE_UNITS, SERVER_CAPABILITIES, SNAPSHOT_ARCHIVE_CONTENT_TYPE, SYNONYMS_CAPABILITY, TASK_CANCEL_CAPABILITY, TASK_FILTER_CAPABILITY, TASK_PROGRESS_WRITE_INTERVAL_MS, TERMINAL_TASK_TTL_MS, acceptorOf, authorizerFor, awaitDepartureConfirmation, badRequest, childAppOf, clearBodyBudgetSlot, clearGateSlot, closeEveryThreadAtExit, closeWhenTheProcessExits, confirmDeparture, corsHeaderReader, createBodyBudgetBuffer, createCloseAtExitWords, createDepartureWord, createDocumentReadHandlers, createRouteRunner, createSharedBodyBudget, createSharedGateBuffer, createSharedRequestGate, createVersionHandler, departureConfirmation, departureConfirmed, encodeJson, gateSlotOfWorker, httpStatusForNarsilError, isRemoveOnlyBatch, loadUWebSockets, parseJson, parseJsonOptional, parseRefusalOf, parseTaskListQuery, parseWriteJson, refuseRegex, registerServerRoutes, rejectInvalid, resolveCors, respondAnswer, respondError, respondJson, sendError, sendRelayed, sendStream, sendText, serializeBatchResult, serializeNarsilError, serverRoutes, statusLine, toHttpError, validateBatch, validateCreateIndex, validateDocumentBody, validateQuery, validateRebalance, validateSuggest, versionReport, withServerRerankWindow };
|
|
2424
|
+
export { ASYNC_IMPORT_CAPABILITY, BM25_TUNING_CAPABILITY, CHANGE_ANALYSIS_CAPABILITY, DEFAULT_IMPORT_BATCH_SIZE, DEFAULT_MAX_BODY_BYTES, DEFAULT_MAX_BODY_BYTES_IN_FLIGHT_FRACTION, DEFAULT_MAX_CONCURRENT_REQUESTS, DEFAULT_MAX_CONCURRENT_TASKS, DEFAULT_MAX_FETCH_DOCUMENTS, DEFAULT_MAX_IMPORT_BYTES, DEFAULT_MAX_IMPORT_ERRORS, DEFAULT_MAX_LINE_BYTES, DEFAULT_MAX_RERANK_WINDOW, DEFAULT_MAX_RESTORE_BYTES, DEFAULT_MAX_RESULT_WINDOW, DEFAULT_MAX_RETAINED_TASKS, DEFAULT_MAX_TASK_PAGE_SIZE, DEFAULT_TASK_PAGE_SIZE, DOCUMENT_EXPORT_CAPABILITY, DOCUMENT_EXPORT_CONTENT_TYPE, IMPORT_FLUSHES_IN_FLIGHT, INDEX_LIFECYCLE_CAPABILITY, INDEX_TOUCH_INTERVALS_PER_IDLE_TIMEOUT, MAIN_THREAD_GATE_SLOT, MAX_BODY_BYTES_IN_FLIGHT_FRACTION, MAX_INDEX_TOUCH_INTERVAL_MS, MAX_LONG_QUERIES_IN_FLIGHT, MIN_COUNTED_SERVER_LIMIT, MIN_UNBOUNDED_SERVER_LIMIT, PROMETHEUS_TEXT_CONTENT_TYPE, REBUILD_ANALYSIS_CAPABILITY, RELAY_STREAM_CHUNKS_IN_FLIGHT, REQUEST_THREAD_CLOSE_AT_EXIT_MS, REQUEST_THREAD_DEPARTURE_DRAIN_MS, REQUEST_THREAD_MOVE_AFTER_MS, RUNNING_TASK_TTL_MS, SEARCH_CLOCK_SAMPLE_UNITS, SERVER_CAPABILITIES, SNAPSHOT_ARCHIVE_CONTENT_TYPE, SYNONYMS_CAPABILITY, TASK_CANCEL_CAPABILITY, TASK_FILTER_CAPABILITY, TASK_PROGRESS_WRITE_INTERVAL_MS, TERMINAL_TASK_TTL_MS, acceptorOf, authorizerFor, awaitDepartureConfirmation, badRequest, childAppOf, clearBodyBudgetSlot, clearGateSlot, closeEveryThreadAtExit, closeWhenTheProcessExits, confirmDeparture, corsHeaderReader, createBodyBudgetBuffer, createCloseAtExitWords, createDepartureWord, createDocumentReadHandlers, createRouteRunner, createSharedBodyBudget, createSharedGateBuffer, createSharedRequestGate, createVersionHandler, departureConfirmation, departureConfirmed, encodeJson, gateSlotOfWorker, httpStatusForNarsilError, isRemoveOnlyBatch, loadUWebSockets, parseJson, parseJsonOptional, parseRefusalOf, parseTaskListQuery, parseWriteJson, refuseRegex, registerServerRoutes, rejectInvalid, resolveCors, respondAnswer, respondError, respondJson, sendError, sendRelayed, sendStream, sendText, serializeBatchResult, serializeNarsilError, serverRoutes, statusLine, toHttpError, validateBatch, validateChangeAnalysis, validateCreateIndex, validateDocumentBody, validateQuery, validateRebalance, validateSuggest, versionReport, withServerRerankWindow };
|