es-mcp-server 1.0.0 → 1.0.1
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/index.js +6 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -331,9 +331,14 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
331
331
|
};
|
|
332
332
|
|
|
333
333
|
case "es_search":
|
|
334
|
+
// 自动包装 query 参数:如果没有外层 query 键,自动添加
|
|
335
|
+
let queryBody = args.query || { match_all: {} };
|
|
336
|
+
if (!queryBody.query) {
|
|
337
|
+
queryBody = { query: queryBody };
|
|
338
|
+
}
|
|
334
339
|
const searchParams = {
|
|
335
340
|
index: args.index,
|
|
336
|
-
body:
|
|
341
|
+
body: queryBody,
|
|
337
342
|
};
|
|
338
343
|
if (args.size) {
|
|
339
344
|
searchParams.size = args.size;
|