chub-dev 0.1.0 → 0.1.2-beta.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.
Files changed (139) hide show
  1. package/README.md +55 -0
  2. package/bin/chub-mcp +2 -0
  3. package/dist/airtable/docs/database/javascript/DOC.md +1437 -0
  4. package/dist/airtable/docs/database/python/DOC.md +1735 -0
  5. package/dist/amplitude/docs/analytics/javascript/DOC.md +1282 -0
  6. package/dist/amplitude/docs/analytics/python/DOC.md +1199 -0
  7. package/dist/anthropic/docs/claude-api/javascript/DOC.md +503 -0
  8. package/dist/anthropic/docs/claude-api/python/DOC.md +389 -0
  9. package/dist/asana/docs/tasks/DOC.md +1396 -0
  10. package/dist/assemblyai/docs/transcription/DOC.md +1043 -0
  11. package/dist/atlassian/docs/confluence/javascript/DOC.md +1347 -0
  12. package/dist/atlassian/docs/confluence/python/DOC.md +1604 -0
  13. package/dist/auth0/docs/identity/javascript/DOC.md +968 -0
  14. package/dist/auth0/docs/identity/python/DOC.md +1199 -0
  15. package/dist/aws/docs/s3/javascript/DOC.md +1773 -0
  16. package/dist/aws/docs/s3/python/DOC.md +1807 -0
  17. package/dist/binance/docs/trading/javascript/DOC.md +1315 -0
  18. package/dist/binance/docs/trading/python/DOC.md +1454 -0
  19. package/dist/braintree/docs/gateway/javascript/DOC.md +1278 -0
  20. package/dist/braintree/docs/gateway/python/DOC.md +1179 -0
  21. package/dist/chromadb/docs/embeddings-db/javascript/DOC.md +1263 -0
  22. package/dist/chromadb/docs/embeddings-db/python/DOC.md +1707 -0
  23. package/dist/clerk/docs/auth/javascript/DOC.md +1220 -0
  24. package/dist/clerk/docs/auth/python/DOC.md +274 -0
  25. package/dist/cloudflare/docs/workers/javascript/DOC.md +918 -0
  26. package/dist/cloudflare/docs/workers/python/DOC.md +994 -0
  27. package/dist/cockroachdb/docs/distributed-db/DOC.md +1500 -0
  28. package/dist/cohere/docs/llm/DOC.md +1335 -0
  29. package/dist/datadog/docs/monitoring/javascript/DOC.md +1740 -0
  30. package/dist/datadog/docs/monitoring/python/DOC.md +1815 -0
  31. package/dist/deepgram/docs/speech/javascript/DOC.md +885 -0
  32. package/dist/deepgram/docs/speech/python/DOC.md +685 -0
  33. package/dist/deepl/docs/translation/javascript/DOC.md +887 -0
  34. package/dist/deepl/docs/translation/python/DOC.md +944 -0
  35. package/dist/deepseek/docs/llm/DOC.md +1220 -0
  36. package/dist/directus/docs/headless-cms/javascript/DOC.md +1128 -0
  37. package/dist/directus/docs/headless-cms/python/DOC.md +1276 -0
  38. package/dist/discord/docs/bot/javascript/DOC.md +1090 -0
  39. package/dist/discord/docs/bot/python/DOC.md +1130 -0
  40. package/dist/elasticsearch/docs/search/DOC.md +1634 -0
  41. package/dist/elevenlabs/docs/text-to-speech/javascript/DOC.md +336 -0
  42. package/dist/elevenlabs/docs/text-to-speech/python/DOC.md +552 -0
  43. package/dist/firebase/docs/auth/DOC.md +1015 -0
  44. package/dist/gemini/docs/genai/javascript/DOC.md +691 -0
  45. package/dist/gemini/docs/genai/python/DOC.md +555 -0
  46. package/dist/github/docs/octokit/DOC.md +1560 -0
  47. package/dist/google/docs/bigquery/javascript/DOC.md +1688 -0
  48. package/dist/google/docs/bigquery/python/DOC.md +1503 -0
  49. package/dist/hubspot/docs/crm/javascript/DOC.md +1805 -0
  50. package/dist/hubspot/docs/crm/python/DOC.md +2033 -0
  51. package/dist/huggingface/docs/transformers/DOC.md +948 -0
  52. package/dist/intercom/docs/messaging/javascript/DOC.md +1844 -0
  53. package/dist/intercom/docs/messaging/python/DOC.md +1797 -0
  54. package/dist/jira/docs/issues/javascript/DOC.md +1420 -0
  55. package/dist/jira/docs/issues/python/DOC.md +1492 -0
  56. package/dist/kafka/docs/streaming/javascript/DOC.md +1671 -0
  57. package/dist/kafka/docs/streaming/python/DOC.md +1464 -0
  58. package/dist/landingai-ade/docs/api/DOC.md +620 -0
  59. package/dist/landingai-ade/docs/sdk/python/DOC.md +489 -0
  60. package/dist/landingai-ade/docs/sdk/typescript/DOC.md +542 -0
  61. package/dist/landingai-ade/skills/SKILL.md +489 -0
  62. package/dist/launchdarkly/docs/feature-flags/javascript/DOC.md +1191 -0
  63. package/dist/launchdarkly/docs/feature-flags/python/DOC.md +1671 -0
  64. package/dist/linear/docs/tracker/DOC.md +1554 -0
  65. package/dist/livekit/docs/realtime/javascript/DOC.md +303 -0
  66. package/dist/livekit/docs/realtime/python/DOC.md +163 -0
  67. package/dist/mailchimp/docs/marketing/DOC.md +1420 -0
  68. package/dist/meilisearch/docs/search/DOC.md +1241 -0
  69. package/dist/microsoft/docs/onedrive/javascript/DOC.md +1421 -0
  70. package/dist/microsoft/docs/onedrive/python/DOC.md +1549 -0
  71. package/dist/mongodb/docs/atlas/DOC.md +2041 -0
  72. package/dist/notion/docs/workspace-api/javascript/DOC.md +1435 -0
  73. package/dist/notion/docs/workspace-api/python/DOC.md +1400 -0
  74. package/dist/okta/docs/identity/javascript/DOC.md +1171 -0
  75. package/dist/okta/docs/identity/python/DOC.md +1401 -0
  76. package/dist/openai/docs/chat/javascript/DOC.md +407 -0
  77. package/dist/openai/docs/chat/python/DOC.md +568 -0
  78. package/dist/paypal/docs/checkout/DOC.md +278 -0
  79. package/dist/pinecone/docs/sdk/javascript/DOC.md +984 -0
  80. package/dist/pinecone/docs/sdk/python/DOC.md +1395 -0
  81. package/dist/plaid/docs/banking/javascript/DOC.md +1163 -0
  82. package/dist/plaid/docs/banking/python/DOC.md +1203 -0
  83. package/dist/playwright-community/skills/login-flows/SKILL.md +108 -0
  84. package/dist/postmark/docs/transactional-email/DOC.md +1168 -0
  85. package/dist/prisma/docs/orm/javascript/DOC.md +1419 -0
  86. package/dist/prisma/docs/orm/python/DOC.md +1317 -0
  87. package/dist/qdrant/docs/vector-search/javascript/DOC.md +1221 -0
  88. package/dist/qdrant/docs/vector-search/python/DOC.md +1653 -0
  89. package/dist/rabbitmq/docs/message-queue/javascript/DOC.md +1193 -0
  90. package/dist/rabbitmq/docs/message-queue/python/DOC.md +1243 -0
  91. package/dist/razorpay/docs/payments/javascript/DOC.md +1219 -0
  92. package/dist/razorpay/docs/payments/python/DOC.md +1330 -0
  93. package/dist/redis/docs/key-value/javascript/DOC.md +1851 -0
  94. package/dist/redis/docs/key-value/python/DOC.md +2054 -0
  95. package/dist/registry.json +2817 -0
  96. package/dist/replicate/docs/model-hosting/DOC.md +1318 -0
  97. package/dist/resend/docs/email/DOC.md +1271 -0
  98. package/dist/salesforce/docs/crm/javascript/DOC.md +1241 -0
  99. package/dist/salesforce/docs/crm/python/DOC.md +1183 -0
  100. package/dist/search-index.json +1 -0
  101. package/dist/sendgrid/docs/email-api/javascript/DOC.md +371 -0
  102. package/dist/sendgrid/docs/email-api/python/DOC.md +656 -0
  103. package/dist/sentry/docs/error-tracking/javascript/DOC.md +1073 -0
  104. package/dist/sentry/docs/error-tracking/python/DOC.md +1309 -0
  105. package/dist/shopify/docs/storefront/DOC.md +457 -0
  106. package/dist/slack/docs/workspace/javascript/DOC.md +933 -0
  107. package/dist/slack/docs/workspace/python/DOC.md +271 -0
  108. package/dist/square/docs/payments/javascript/DOC.md +1855 -0
  109. package/dist/square/docs/payments/python/DOC.md +1728 -0
  110. package/dist/stripe/docs/api/DOC.md +1727 -0
  111. package/dist/stripe/docs/payments/DOC.md +1726 -0
  112. package/dist/stytch/docs/auth/javascript/DOC.md +1813 -0
  113. package/dist/stytch/docs/auth/python/DOC.md +1962 -0
  114. package/dist/supabase/docs/client/DOC.md +1606 -0
  115. package/dist/twilio/docs/messaging/python/DOC.md +469 -0
  116. package/dist/twilio/docs/messaging/typescript/DOC.md +946 -0
  117. package/dist/vercel/docs/platform/DOC.md +1940 -0
  118. package/dist/weaviate/docs/vector-db/javascript/DOC.md +1268 -0
  119. package/dist/weaviate/docs/vector-db/python/DOC.md +1388 -0
  120. package/dist/zendesk/docs/support/javascript/DOC.md +2150 -0
  121. package/dist/zendesk/docs/support/python/DOC.md +2297 -0
  122. package/package.json +22 -6
  123. package/skills/get-api-docs/SKILL.md +84 -0
  124. package/src/commands/annotate.js +83 -0
  125. package/src/commands/build.js +12 -1
  126. package/src/commands/feedback.js +150 -0
  127. package/src/commands/get.js +83 -42
  128. package/src/commands/search.js +7 -0
  129. package/src/index.js +43 -17
  130. package/src/lib/analytics.js +90 -0
  131. package/src/lib/annotations.js +57 -0
  132. package/src/lib/bm25.js +170 -0
  133. package/src/lib/cache.js +69 -6
  134. package/src/lib/config.js +8 -3
  135. package/src/lib/identity.js +99 -0
  136. package/src/lib/registry.js +103 -20
  137. package/src/lib/telemetry.js +86 -0
  138. package/src/mcp/server.js +177 -0
  139. package/src/mcp/tools.js +251 -0
@@ -0,0 +1,1221 @@
1
+ ---
2
+ name: vector-search
3
+ description: "Qdrant JavaScript SDK — use @qdrant/js-client-rest for vector database operations"
4
+ metadata:
5
+ languages: "javascript"
6
+ versions: "1.15.1"
7
+ updated-on: "2026-03-02"
8
+ source: maintainer
9
+ tags: "qdrant,vector-search,embeddings,similarity,ai"
10
+ ---
11
+
12
+ # Qdrant JavaScript SDK v1.15.1
13
+
14
+ ## Golden Rule
15
+
16
+ **Always use `@qdrant/js-client-rest` for Qdrant vector database operations.**
17
+
18
+ Install with:
19
+ ```bash
20
+ npm install @qdrant/js-client-rest
21
+ ```
22
+
23
+ **Do NOT use:**
24
+ - `node-qdrant` (deprecated, unmaintained)
25
+ - `@qdrant/qdrant-js` (main package, but REST client is preferred for most use cases)
26
+ - `@qdrant/js-client-grpc` (unless you specifically need gRPC)
27
+
28
+ The REST client is recommended for most applications. It's easier to debug and provides all necessary functionality. Use gRPC only when you need maximum performance.
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ npm install @qdrant/js-client-rest
34
+ ```
35
+
36
+ For TypeScript projects, types are included automatically.
37
+
38
+ ## Initialization
39
+
40
+ ### Basic Client Setup
41
+
42
+ ```javascript
43
+ import { QdrantClient } from '@qdrant/js-client-rest';
44
+
45
+ // Local Qdrant instance
46
+ const client = new QdrantClient({
47
+ url: 'http://127.0.0.1:6333'
48
+ });
49
+ ```
50
+
51
+ ### Alternative Initialization
52
+
53
+ ```javascript
54
+ import { QdrantClient } from '@qdrant/js-client-rest';
55
+
56
+ // Using host and port
57
+ const client = new QdrantClient({
58
+ host: 'localhost',
59
+ port: 6333
60
+ });
61
+ ```
62
+
63
+ ### Cloud Configuration
64
+
65
+ ```javascript
66
+ import { QdrantClient } from '@qdrant/js-client-rest';
67
+
68
+ // Qdrant Cloud with API key
69
+ const client = new QdrantClient({
70
+ url: 'https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.us-east-0-1.aws.cloud.qdrant.io',
71
+ apiKey: process.env.QDRANT_API_KEY,
72
+ });
73
+ ```
74
+
75
+ ### With Environment Variables
76
+
77
+ ```javascript
78
+ import { QdrantClient } from '@qdrant/js-client-rest';
79
+
80
+ const client = new QdrantClient({
81
+ url: process.env.QDRANT_URL || 'http://127.0.0.1:6333',
82
+ apiKey: process.env.QDRANT_API_KEY,
83
+ });
84
+ ```
85
+
86
+ ## Collections
87
+
88
+ ### List Collections
89
+
90
+ ```javascript
91
+ const result = await client.getCollections();
92
+ console.log('Collections:', result.collections);
93
+ ```
94
+
95
+ ### Create Collection - Single Vector
96
+
97
+ ```javascript
98
+ await client.createCollection('my_collection', {
99
+ vectors: {
100
+ size: 384,
101
+ distance: 'Cosine'
102
+ }
103
+ });
104
+ ```
105
+
106
+ ### Create Collection - Named Vectors
107
+
108
+ ```javascript
109
+ await client.createCollection('multi_vector_collection', {
110
+ vectors: {
111
+ image: {
112
+ size: 512,
113
+ distance: 'Dot'
114
+ },
115
+ text: {
116
+ size: 384,
117
+ distance: 'Cosine'
118
+ },
119
+ },
120
+ });
121
+ ```
122
+
123
+ ### Create Collection - Multivector Configuration
124
+
125
+ ```javascript
126
+ await client.createCollection('multivec_collection', {
127
+ vectors: {
128
+ size: 128,
129
+ distance: 'Cosine',
130
+ multivector_config: {
131
+ comparator: 'max_sim'
132
+ }
133
+ }
134
+ });
135
+ ```
136
+
137
+ ### Distance Metrics
138
+
139
+ Available distance metrics:
140
+ - `"Cosine"` - Cosine similarity (normalized dot product)
141
+ - `"Euclid"` - Euclidean distance (L2)
142
+ - `"Dot"` - Dot product
143
+ - `"Manhattan"` - Manhattan distance (L1)
144
+
145
+ ### Create Collection - Advanced Options
146
+
147
+ ```javascript
148
+ await client.createCollection('advanced_collection', {
149
+ vectors: {
150
+ size: 768,
151
+ distance: 'Cosine',
152
+ on_disk: false,
153
+ },
154
+ shard_number: 2,
155
+ replication_factor: 1,
156
+ write_consistency_factor: 1,
157
+ optimizers_config: {
158
+ default_segment_number: 2,
159
+ indexing_threshold: 20000,
160
+ },
161
+ hnsw_config: {
162
+ m: 16,
163
+ ef_construct: 100,
164
+ full_scan_threshold: 10000,
165
+ }
166
+ });
167
+ ```
168
+
169
+ ### Get Collection Info
170
+
171
+ ```javascript
172
+ const info = await client.getCollection('my_collection');
173
+ console.log('Collection info:', info);
174
+ ```
175
+
176
+ ### Delete Collection
177
+
178
+ ```javascript
179
+ await client.deleteCollection('my_collection');
180
+ ```
181
+
182
+ ### Update Collection
183
+
184
+ ```javascript
185
+ await client.updateCollection('my_collection', {
186
+ optimizers_config: {
187
+ indexing_threshold: 30000
188
+ }
189
+ });
190
+ ```
191
+
192
+ ## Points (Vectors)
193
+
194
+ ### Upsert Points - Basic
195
+
196
+ ```javascript
197
+ await client.upsert('my_collection', {
198
+ points: [
199
+ {
200
+ id: 1,
201
+ vector: [0.05, 0.61, 0.76, 0.74],
202
+ payload: {
203
+ city: 'Berlin',
204
+ price: 1.99,
205
+ }
206
+ },
207
+ {
208
+ id: 2,
209
+ vector: [0.19, 0.81, 0.75, 0.11],
210
+ payload: {
211
+ city: 'London',
212
+ price: 2.49,
213
+ }
214
+ }
215
+ ]
216
+ });
217
+ ```
218
+
219
+ ### Upsert Points - Named Vectors
220
+
221
+ ```javascript
222
+ await client.upsert('multi_vector_collection', {
223
+ points: [
224
+ {
225
+ id: 1,
226
+ vector: {
227
+ image: [0.1, 0.2, 0.3, 0.4],
228
+ text: [0.5, 0.6, 0.7, 0.8, 0.9, 0.1, 0.2, 0.3]
229
+ },
230
+ payload: {
231
+ title: 'Product A',
232
+ category: 'electronics'
233
+ }
234
+ }
235
+ ]
236
+ });
237
+ ```
238
+
239
+ ### Upsert Points - Sparse Vectors
240
+
241
+ ```javascript
242
+ await client.upsert('sparse_collection', {
243
+ points: [
244
+ {
245
+ id: 1,
246
+ vector: {
247
+ text: {
248
+ indices: [1, 3, 5, 7],
249
+ values: [0.1, 0.2, 0.3, 0.4]
250
+ }
251
+ },
252
+ payload: {
253
+ document: 'Sample text'
254
+ }
255
+ }
256
+ ]
257
+ });
258
+ ```
259
+
260
+ ### Upsert Points - Batch Insert
261
+
262
+ ```javascript
263
+ const points = [];
264
+ for (let i = 0; i < 1000; i++) {
265
+ points.push({
266
+ id: i,
267
+ vector: Array(384).fill(0).map(() => Math.random()),
268
+ payload: {
269
+ index: i,
270
+ category: `cat_${i % 10}`
271
+ }
272
+ });
273
+ }
274
+
275
+ await client.upsert('my_collection', {
276
+ points: points,
277
+ wait: true
278
+ });
279
+ ```
280
+
281
+ ### Retrieve Points by ID
282
+
283
+ ```javascript
284
+ const points = await client.retrieve('my_collection', {
285
+ ids: [1, 2, 3],
286
+ with_payload: true,
287
+ with_vector: false
288
+ });
289
+ console.log('Retrieved points:', points);
290
+ ```
291
+
292
+ ### Retrieve Points - With Vectors
293
+
294
+ ```javascript
295
+ const points = await client.retrieve('my_collection', {
296
+ ids: [1, 2, 3],
297
+ with_payload: true,
298
+ with_vector: true
299
+ });
300
+ ```
301
+
302
+ ### Delete Points by ID
303
+
304
+ ```javascript
305
+ await client.delete('my_collection', {
306
+ points: [1, 2, 3]
307
+ });
308
+ ```
309
+
310
+ ### Delete Points by Filter
311
+
312
+ ```javascript
313
+ await client.delete('my_collection', {
314
+ filter: {
315
+ must: [
316
+ {
317
+ key: 'city',
318
+ match: {
319
+ value: 'Berlin'
320
+ }
321
+ }
322
+ ]
323
+ }
324
+ });
325
+ ```
326
+
327
+ ### Count Points
328
+
329
+ ```javascript
330
+ const count = await client.count('my_collection', {
331
+ exact: true
332
+ });
333
+ console.log('Total points:', count.count);
334
+ ```
335
+
336
+ ### Count Points with Filter
337
+
338
+ ```javascript
339
+ const count = await client.count('my_collection', {
340
+ filter: {
341
+ must: [
342
+ {
343
+ key: 'price',
344
+ range: {
345
+ gte: 2.0
346
+ }
347
+ }
348
+ ]
349
+ },
350
+ exact: true
351
+ });
352
+ ```
353
+
354
+ ## Scroll (Pagination)
355
+
356
+ ### Basic Scroll
357
+
358
+ ```javascript
359
+ const result = await client.scroll('my_collection', {
360
+ limit: 10,
361
+ with_payload: true,
362
+ with_vector: false
363
+ });
364
+
365
+ console.log('Points:', result.points);
366
+ console.log('Next offset:', result.next_page_offset);
367
+ ```
368
+
369
+ ### Scroll with Filter
370
+
371
+ ```javascript
372
+ const result = await client.scroll('my_collection', {
373
+ filter: {
374
+ must: [
375
+ {
376
+ key: 'city',
377
+ match: {
378
+ value: 'Berlin'
379
+ }
380
+ }
381
+ ]
382
+ },
383
+ limit: 20,
384
+ with_payload: true
385
+ });
386
+ ```
387
+
388
+ ### Scroll Pagination
389
+
390
+ ```javascript
391
+ let offset = null;
392
+ const allPoints = [];
393
+
394
+ while (true) {
395
+ const result = await client.scroll('my_collection', {
396
+ limit: 100,
397
+ offset: offset,
398
+ with_payload: true,
399
+ with_vector: false
400
+ });
401
+
402
+ allPoints.push(...result.points);
403
+
404
+ if (!result.next_page_offset) {
405
+ break;
406
+ }
407
+
408
+ offset = result.next_page_offset;
409
+ }
410
+
411
+ console.log('Total points retrieved:', allPoints.length);
412
+ ```
413
+
414
+ ### Scroll with Order
415
+
416
+ ```javascript
417
+ const result = await client.scroll('my_collection', {
418
+ limit: 10,
419
+ order_by: 'price',
420
+ with_payload: true
421
+ });
422
+ ```
423
+
424
+ ## Search
425
+
426
+ ### Basic Vector Search
427
+
428
+ ```javascript
429
+ const results = await client.search('my_collection', {
430
+ vector: [0.18, 0.81, 0.75, 0.12],
431
+ limit: 5
432
+ });
433
+
434
+ results.forEach(result => {
435
+ console.log(`ID: ${result.id}, Score: ${result.score}`);
436
+ console.log('Payload:', result.payload);
437
+ });
438
+ ```
439
+
440
+ ### Search with Payload Only
441
+
442
+ ```javascript
443
+ const results = await client.search('my_collection', {
444
+ vector: [0.18, 0.81, 0.75, 0.12],
445
+ limit: 5,
446
+ with_payload: true,
447
+ with_vector: false
448
+ });
449
+ ```
450
+
451
+ ### Search with Score Threshold
452
+
453
+ ```javascript
454
+ const results = await client.search('my_collection', {
455
+ vector: [0.18, 0.81, 0.75, 0.12],
456
+ limit: 10,
457
+ score_threshold: 0.8
458
+ });
459
+ ```
460
+
461
+ ### Search Named Vectors
462
+
463
+ ```javascript
464
+ const results = await client.search('multi_vector_collection', {
465
+ vector: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8],
466
+ using: 'text',
467
+ limit: 5
468
+ });
469
+ ```
470
+
471
+ ## Filtering
472
+
473
+ ### Match Filter
474
+
475
+ ```javascript
476
+ const results = await client.search('my_collection', {
477
+ vector: [0.18, 0.81, 0.75, 0.12],
478
+ filter: {
479
+ must: [
480
+ {
481
+ key: 'city',
482
+ match: {
483
+ value: 'Berlin'
484
+ }
485
+ }
486
+ ]
487
+ },
488
+ limit: 5
489
+ });
490
+ ```
491
+
492
+ ### Range Filter
493
+
494
+ ```javascript
495
+ const results = await client.search('my_collection', {
496
+ vector: [0.18, 0.81, 0.75, 0.12],
497
+ filter: {
498
+ must: [
499
+ {
500
+ key: 'price',
501
+ range: {
502
+ gte: 1.0,
503
+ lt: 3.0
504
+ }
505
+ }
506
+ ]
507
+ },
508
+ limit: 5
509
+ });
510
+ ```
511
+
512
+ ### Multiple Conditions (AND)
513
+
514
+ ```javascript
515
+ const results = await client.search('my_collection', {
516
+ vector: [0.18, 0.81, 0.75, 0.12],
517
+ filter: {
518
+ must: [
519
+ {
520
+ key: 'city',
521
+ match: {
522
+ value: 'Berlin'
523
+ }
524
+ },
525
+ {
526
+ key: 'price',
527
+ range: {
528
+ gte: 2.0
529
+ }
530
+ }
531
+ ]
532
+ },
533
+ limit: 5
534
+ });
535
+ ```
536
+
537
+ ### OR Conditions
538
+
539
+ ```javascript
540
+ const results = await client.search('my_collection', {
541
+ vector: [0.18, 0.81, 0.75, 0.12],
542
+ filter: {
543
+ should: [
544
+ {
545
+ key: 'city',
546
+ match: {
547
+ value: 'Berlin'
548
+ }
549
+ },
550
+ {
551
+ key: 'city',
552
+ match: {
553
+ value: 'London'
554
+ }
555
+ }
556
+ ]
557
+ },
558
+ limit: 5
559
+ });
560
+ ```
561
+
562
+ ### NOT Conditions
563
+
564
+ ```javascript
565
+ const results = await client.search('my_collection', {
566
+ vector: [0.18, 0.81, 0.75, 0.12],
567
+ filter: {
568
+ must_not: [
569
+ {
570
+ key: 'city',
571
+ match: {
572
+ value: 'Berlin'
573
+ }
574
+ }
575
+ ]
576
+ },
577
+ limit: 5
578
+ });
579
+ ```
580
+
581
+ ### Complex Filter
582
+
583
+ ```javascript
584
+ const results = await client.search('my_collection', {
585
+ vector: [0.18, 0.81, 0.75, 0.12],
586
+ filter: {
587
+ must: [
588
+ {
589
+ key: 'category',
590
+ match: {
591
+ value: 'electronics'
592
+ }
593
+ }
594
+ ],
595
+ should: [
596
+ {
597
+ key: 'price',
598
+ range: {
599
+ lt: 100
600
+ }
601
+ },
602
+ {
603
+ key: 'discount',
604
+ match: {
605
+ value: true
606
+ }
607
+ }
608
+ ],
609
+ must_not: [
610
+ {
611
+ key: 'out_of_stock',
612
+ match: {
613
+ value: true
614
+ }
615
+ }
616
+ ]
617
+ },
618
+ limit: 10
619
+ });
620
+ ```
621
+
622
+ ### Match Any (Array)
623
+
624
+ ```javascript
625
+ const results = await client.search('my_collection', {
626
+ vector: [0.18, 0.81, 0.75, 0.12],
627
+ filter: {
628
+ must: [
629
+ {
630
+ key: 'tags',
631
+ match: {
632
+ any: ['electronics', 'gadgets', 'tech']
633
+ }
634
+ }
635
+ ]
636
+ },
637
+ limit: 5
638
+ });
639
+ ```
640
+
641
+ ### Geo Radius Filter
642
+
643
+ ```javascript
644
+ const results = await client.search('my_collection', {
645
+ vector: [0.18, 0.81, 0.75, 0.12],
646
+ filter: {
647
+ must: [
648
+ {
649
+ key: 'location',
650
+ geo_radius: {
651
+ center: {
652
+ lon: 13.404954,
653
+ lat: 52.520008
654
+ },
655
+ radius: 5000.0
656
+ }
657
+ }
658
+ ]
659
+ },
660
+ limit: 5
661
+ });
662
+ ```
663
+
664
+ ### Is Empty Filter
665
+
666
+ ```javascript
667
+ const results = await client.search('my_collection', {
668
+ vector: [0.18, 0.81, 0.75, 0.12],
669
+ filter: {
670
+ must: [
671
+ {
672
+ is_empty: {
673
+ key: 'tags'
674
+ }
675
+ }
676
+ ]
677
+ },
678
+ limit: 5
679
+ });
680
+ ```
681
+
682
+ ## Query API (Universal)
683
+
684
+ ### Basic Query
685
+
686
+ ```javascript
687
+ const results = await client.query('my_collection', {
688
+ query: [0.1, 0.2, 0.3, 0.4],
689
+ limit: 10
690
+ });
691
+ ```
692
+
693
+ ### Query with Filter
694
+
695
+ ```javascript
696
+ const results = await client.query('my_collection', {
697
+ query: [0.1, 0.1, 0.9],
698
+ filter: {
699
+ must: [
700
+ {
701
+ key: 'group_id',
702
+ match: {
703
+ value: 'user_1'
704
+ }
705
+ }
706
+ ]
707
+ },
708
+ limit: 10
709
+ });
710
+ ```
711
+
712
+ ### Recommend Query
713
+
714
+ ```javascript
715
+ const results = await client.query('my_collection', {
716
+ query: {
717
+ recommend: {
718
+ positive: [100, 231],
719
+ negative: [718]
720
+ }
721
+ },
722
+ limit: 10
723
+ });
724
+ ```
725
+
726
+ ### Recommend with Vector Examples
727
+
728
+ ```javascript
729
+ const results = await client.query('my_collection', {
730
+ query: {
731
+ recommend: {
732
+ positive: [100, 231],
733
+ negative: [[0.2, 0.3, 0.4, 0.5]]
734
+ }
735
+ },
736
+ limit: 10
737
+ });
738
+ ```
739
+
740
+ ### Discover Query
741
+
742
+ ```javascript
743
+ const results = await client.query('my_collection', {
744
+ query: {
745
+ discover: {
746
+ target: 100,
747
+ context: [
748
+ {
749
+ positive: 200,
750
+ negative: 300
751
+ },
752
+ {
753
+ positive: 150,
754
+ negative: 250
755
+ }
756
+ ]
757
+ }
758
+ },
759
+ limit: 10
760
+ });
761
+ ```
762
+
763
+ ### Context Query
764
+
765
+ ```javascript
766
+ const results = await client.query('my_collection', {
767
+ query: {
768
+ context: [
769
+ {
770
+ positive: 100,
771
+ negative: 718
772
+ },
773
+ {
774
+ positive: 200,
775
+ negative: 300
776
+ }
777
+ ]
778
+ },
779
+ limit: 10
780
+ });
781
+ ```
782
+
783
+ ## Batch Operations
784
+
785
+ ### Batch Search
786
+
787
+ ```javascript
788
+ const requests = [
789
+ {
790
+ vector: [0.1, 0.2, 0.3, 0.4],
791
+ limit: 5,
792
+ filter: {
793
+ must: [{ key: 'category', match: { value: 'electronics' } }]
794
+ }
795
+ },
796
+ {
797
+ vector: [0.5, 0.6, 0.7, 0.8],
798
+ limit: 5,
799
+ filter: {
800
+ must: [{ key: 'category', match: { value: 'books' } }]
801
+ }
802
+ }
803
+ ];
804
+
805
+ const results = await client.searchBatch('my_collection', {
806
+ searches: requests
807
+ });
808
+
809
+ results.forEach((result, index) => {
810
+ console.log(`Results for request ${index}:`, result);
811
+ });
812
+ ```
813
+
814
+ ### Batch Query
815
+
816
+ ```javascript
817
+ const requests = [
818
+ {
819
+ query: [0.1, 0.2, 0.3, 0.4],
820
+ limit: 5
821
+ },
822
+ {
823
+ query: {
824
+ recommend: {
825
+ positive: [100, 200],
826
+ negative: [300]
827
+ }
828
+ },
829
+ limit: 5
830
+ }
831
+ ];
832
+
833
+ const results = await client.queryBatch('my_collection', {
834
+ requests: requests
835
+ });
836
+ ```
837
+
838
+ ### Batch Recommend
839
+
840
+ ```javascript
841
+ const requests = [
842
+ {
843
+ positive: [100, 231],
844
+ negative: [718],
845
+ limit: 10
846
+ },
847
+ {
848
+ positive: [500, 600],
849
+ negative: [700, 800],
850
+ limit: 10,
851
+ filter: {
852
+ must: [{ key: 'active', match: { value: true } }]
853
+ }
854
+ }
855
+ ];
856
+
857
+ const results = await client.recommendBatch('my_collection', {
858
+ searches: requests
859
+ });
860
+ ```
861
+
862
+ ### Batch Upsert Operations
863
+
864
+ ```javascript
865
+ const operations = [
866
+ {
867
+ upsert: {
868
+ points: [
869
+ {
870
+ id: 1,
871
+ vector: [0.1, 0.2, 0.3, 0.4],
872
+ payload: { title: 'First' }
873
+ }
874
+ ]
875
+ }
876
+ },
877
+ {
878
+ upsert: {
879
+ points: [
880
+ {
881
+ id: 2,
882
+ vector: [0.5, 0.6, 0.7, 0.8],
883
+ payload: { title: 'Second' }
884
+ }
885
+ ]
886
+ }
887
+ }
888
+ ];
889
+
890
+ await client.batch('my_collection', {
891
+ operations: operations
892
+ });
893
+ ```
894
+
895
+ ### Mixed Batch Operations
896
+
897
+ ```javascript
898
+ const operations = [
899
+ {
900
+ upsert: {
901
+ points: [
902
+ { id: 1, vector: [0.1, 0.2, 0.3, 0.4], payload: { title: 'Item 1' } }
903
+ ]
904
+ }
905
+ },
906
+ {
907
+ delete_points: {
908
+ points: [5, 6, 7]
909
+ }
910
+ },
911
+ {
912
+ set_payload: {
913
+ payload: { updated: true },
914
+ points: [1, 2, 3]
915
+ }
916
+ }
917
+ ];
918
+
919
+ await client.batch('my_collection', {
920
+ operations: operations,
921
+ wait: true
922
+ });
923
+ ```
924
+
925
+ ## Payload Operations
926
+
927
+ ### Set Payload
928
+
929
+ ```javascript
930
+ await client.setPayload('my_collection', {
931
+ payload: {
932
+ updated_at: new Date().toISOString(),
933
+ verified: true
934
+ },
935
+ points: [1, 2, 3]
936
+ });
937
+ ```
938
+
939
+ ### Set Payload with Filter
940
+
941
+ ```javascript
942
+ await client.setPayload('my_collection', {
943
+ payload: {
944
+ promoted: true
945
+ },
946
+ filter: {
947
+ must: [
948
+ {
949
+ key: 'price',
950
+ range: {
951
+ lt: 50
952
+ }
953
+ }
954
+ ]
955
+ }
956
+ });
957
+ ```
958
+
959
+ ### Overwrite Payload
960
+
961
+ ```javascript
962
+ await client.overwritePayload('my_collection', {
963
+ payload: {
964
+ title: 'New Title',
965
+ price: 99.99
966
+ },
967
+ points: [1, 2]
968
+ });
969
+ ```
970
+
971
+ ### Delete Payload Keys
972
+
973
+ ```javascript
974
+ await client.deletePayload('my_collection', {
975
+ keys: ['old_field', 'deprecated_field'],
976
+ points: [1, 2, 3]
977
+ });
978
+ ```
979
+
980
+ ### Clear Payload
981
+
982
+ ```javascript
983
+ await client.clearPayload('my_collection', {
984
+ points: [1, 2, 3]
985
+ });
986
+ ```
987
+
988
+ ## Snapshots
989
+
990
+ ### Create Collection Snapshot
991
+
992
+ ```javascript
993
+ const snapshot = await client.createSnapshot('my_collection');
994
+ console.log('Snapshot name:', snapshot.name);
995
+ ```
996
+
997
+ ### List Collection Snapshots
998
+
999
+ ```javascript
1000
+ const snapshots = await client.listSnapshots('my_collection');
1001
+ console.log('Snapshots:', snapshots);
1002
+ ```
1003
+
1004
+ ### Delete Snapshot
1005
+
1006
+ ```javascript
1007
+ await client.deleteSnapshot('my_collection', 'snapshot_name');
1008
+ ```
1009
+
1010
+ ### Create Full Storage Snapshot
1011
+
1012
+ ```javascript
1013
+ const snapshot = await client.createFullSnapshot();
1014
+ console.log('Full snapshot:', snapshot.name);
1015
+ ```
1016
+
1017
+ ## Cluster Operations
1018
+
1019
+ ### Get Cluster Info
1020
+
1021
+ ```javascript
1022
+ const clusterInfo = await client.clusterStatus();
1023
+ console.log('Cluster status:', clusterInfo);
1024
+ ```
1025
+
1026
+ ## Payload Indexing
1027
+
1028
+ ### Create Payload Index
1029
+
1030
+ ```javascript
1031
+ await client.createPayloadIndex('my_collection', {
1032
+ field_name: 'city',
1033
+ field_schema: 'keyword'
1034
+ });
1035
+ ```
1036
+
1037
+ ### Create Payload Index - Integer
1038
+
1039
+ ```javascript
1040
+ await client.createPayloadIndex('my_collection', {
1041
+ field_name: 'price',
1042
+ field_schema: 'integer'
1043
+ });
1044
+ ```
1045
+
1046
+ ### Create Payload Index - Float
1047
+
1048
+ ```javascript
1049
+ await client.createPayloadIndex('my_collection', {
1050
+ field_name: 'rating',
1051
+ field_schema: 'float'
1052
+ });
1053
+ ```
1054
+
1055
+ ### Create Payload Index - Geo
1056
+
1057
+ ```javascript
1058
+ await client.createPayloadIndex('my_collection', {
1059
+ field_name: 'location',
1060
+ field_schema: 'geo'
1061
+ });
1062
+ ```
1063
+
1064
+ ### Delete Payload Index
1065
+
1066
+ ```javascript
1067
+ await client.deletePayloadIndex('my_collection', 'field_name');
1068
+ ```
1069
+
1070
+ ## Error Handling
1071
+
1072
+ ### Basic Error Handling
1073
+
1074
+ ```javascript
1075
+ try {
1076
+ const results = await client.search('my_collection', {
1077
+ vector: [0.1, 0.2, 0.3, 0.4],
1078
+ limit: 10
1079
+ });
1080
+ console.log('Results:', results);
1081
+ } catch (error) {
1082
+ console.error('Search failed:', error.message);
1083
+ }
1084
+ ```
1085
+
1086
+ ### Check Collection Exists
1087
+
1088
+ ```javascript
1089
+ try {
1090
+ const info = await client.getCollection('my_collection');
1091
+ console.log('Collection exists');
1092
+ } catch (error) {
1093
+ if (error.status === 404) {
1094
+ console.log('Collection does not exist');
1095
+ // Create collection
1096
+ await client.createCollection('my_collection', {
1097
+ vectors: { size: 384, distance: 'Cosine' }
1098
+ });
1099
+ } else {
1100
+ throw error;
1101
+ }
1102
+ }
1103
+ ```
1104
+
1105
+ ### Retry Logic
1106
+
1107
+ ```javascript
1108
+ async function searchWithRetry(collection, params, maxRetries = 3) {
1109
+ for (let i = 0; i < maxRetries; i++) {
1110
+ try {
1111
+ return await client.search(collection, params);
1112
+ } catch (error) {
1113
+ if (i === maxRetries - 1) throw error;
1114
+ await new Promise(resolve => setTimeout(resolve, 1000 * (i + 1)));
1115
+ }
1116
+ }
1117
+ }
1118
+
1119
+ const results = await searchWithRetry('my_collection', {
1120
+ vector: [0.1, 0.2, 0.3, 0.4],
1121
+ limit: 10
1122
+ });
1123
+ ```
1124
+
1125
+ ## Complete Example
1126
+
1127
+ ```javascript
1128
+ import { QdrantClient } from '@qdrant/js-client-rest';
1129
+
1130
+ const client = new QdrantClient({
1131
+ url: process.env.QDRANT_URL || 'http://127.0.0.1:6333',
1132
+ apiKey: process.env.QDRANT_API_KEY
1133
+ });
1134
+
1135
+ async function main() {
1136
+ const collectionName = 'products';
1137
+
1138
+ // Create collection
1139
+ await client.createCollection(collectionName, {
1140
+ vectors: { size: 4, distance: 'Cosine' }
1141
+ });
1142
+
1143
+ // Upsert points
1144
+ await client.upsert(collectionName, {
1145
+ points: [
1146
+ {
1147
+ id: 1,
1148
+ vector: [0.05, 0.61, 0.76, 0.74],
1149
+ payload: {
1150
+ name: 'Product A',
1151
+ category: 'electronics',
1152
+ price: 299.99
1153
+ }
1154
+ },
1155
+ {
1156
+ id: 2,
1157
+ vector: [0.19, 0.81, 0.75, 0.11],
1158
+ payload: {
1159
+ name: 'Product B',
1160
+ category: 'electronics',
1161
+ price: 199.99
1162
+ }
1163
+ },
1164
+ {
1165
+ id: 3,
1166
+ vector: [0.36, 0.55, 0.47, 0.94],
1167
+ payload: {
1168
+ name: 'Product C',
1169
+ category: 'books',
1170
+ price: 29.99
1171
+ }
1172
+ }
1173
+ ]
1174
+ });
1175
+
1176
+ // Search
1177
+ const results = await client.search(collectionName, {
1178
+ vector: [0.2, 0.7, 0.8, 0.1],
1179
+ limit: 2,
1180
+ with_payload: true
1181
+ });
1182
+
1183
+ console.log('Search results:');
1184
+ results.forEach(result => {
1185
+ console.log(` ${result.payload.name} - Score: ${result.score}`);
1186
+ });
1187
+
1188
+ // Filtered search
1189
+ const filteredResults = await client.search(collectionName, {
1190
+ vector: [0.2, 0.7, 0.8, 0.1],
1191
+ filter: {
1192
+ must: [
1193
+ {
1194
+ key: 'category',
1195
+ match: { value: 'electronics' }
1196
+ },
1197
+ {
1198
+ key: 'price',
1199
+ range: { lt: 250 }
1200
+ }
1201
+ ]
1202
+ },
1203
+ limit: 5
1204
+ });
1205
+
1206
+ console.log('\nFiltered results:');
1207
+ filteredResults.forEach(result => {
1208
+ console.log(` ${result.payload.name} - $${result.payload.price}`);
1209
+ });
1210
+
1211
+ // Count points
1212
+ const count = await client.count(collectionName, { exact: true });
1213
+ console.log(`\nTotal points: ${count.count}`);
1214
+
1215
+ // Delete collection
1216
+ await client.deleteCollection(collectionName);
1217
+ console.log('Collection deleted');
1218
+ }
1219
+
1220
+ main().catch(console.error);
1221
+ ```