-
-
Notifications
You must be signed in to change notification settings - Fork 26
/
openapi.yml
3561 lines (3474 loc) · 117 KB
/
openapi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.3
info:
title: Typesense API
description: "An open source search engine for building delightful search experiences."
version: '27.0'
externalDocs:
description: Find out more about Typsesense
url: https://typesense.org
security:
- api_key_header: []
tags:
- name: collections
description: A collection is defined by a schema
externalDocs:
description: Find out more
url: https://typesense.org/api/#create-collection
- name: documents
description: A document is an individual record to be indexed and belongs to a collection
externalDocs:
description: Find out more
url: https://typesense.org/api/#index-document
- name: curation
description: Hand-curate search results based on conditional business rules
externalDocs:
description: Find out more
url: https://typesense.org/docs/0.23.0/api/#curation
- name: analytics
description: Typesense can aggregate search queries for both analytics purposes and for query suggestions.
externalDocs:
description: Find out more
url: https://typesense.org/docs/26.0/api/analytics-query-suggestions.html
- name: keys
description: Manage API Keys with fine-grain access control
externalDocs:
description: Find out more
url: https://typesense.org/docs/0.23.0/api/#api-keys
- name: debug
description: Debugging information
- name: operations
description: Manage Typesense cluster
externalDocs:
description: Find out more
url: https://typesense.org/docs/26.0/api/cluster-operations.html
- name: stopwords
description: Manage stopwords sets
externalDocs:
description: Find out more
url: https://typesense.org/docs/26.0/api/stopwords.html
- name: presets
description: Store and reference search parameters
externalDocs:
description: Find out more
url: https://typesense.org/docs/26.0/api/search.html#presets
- name: conversations
description: Conversational Search (RAG)
externalDocs:
description: Find out more
url: https://typesense.org/docs/27.0/api/conversational-search-rag.html
- name: synonyms
description: Manage synonyms
externalDocs:
description: Find out more
url: https://typesense.org/docs/27.0/api/synonyms.html
paths:
/collections:
get:
tags:
- collections
summary: List all collections
description:
Returns a summary of all your collections. The collections are
returned sorted by creation date, with the most recent collections appearing
first.
operationId: getCollections
responses:
'200':
description: List of all collections
content:
application/json:
schema:
type: array
x-go-type: "[]*CollectionResponse"
items:
$ref: "#/components/schemas/CollectionResponse"
post:
tags:
- collections
summary: Create a new collection
description:
When a collection is created, we give it a name and describe the
fields that will be indexed from the documents added to the collection.
operationId: createCollection
requestBody:
description: The collection object to be created
content:
application/json:
schema:
$ref: "#/components/schemas/CollectionSchema"
required: true
responses:
'201':
description: Collection successfully created
content:
application/json:
schema:
$ref: "#/components/schemas/CollectionResponse"
'400':
description: Bad request, see error message for details
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
'409':
description: Collection already exists
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
/collections/{collectionName}:
get:
tags:
- collections
summary: Retrieve a single collection
description: Retrieve the details of a collection, given its name.
operationId: getCollection
parameters:
- name: collectionName
in: path
description: The name of the collection to retrieve
required: true
schema:
type: string
responses:
'200':
description: Collection fetched
content:
application/json:
schema:
$ref: "#/components/schemas/CollectionResponse"
'404':
description: Collection not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
patch:
tags:
- collections
summary: Update a collection
description:
Update a collection's schema to modify the fields and their types.
operationId: updateCollection
parameters:
- name: collectionName
in: path
description: The name of the collection to update
required: true
schema:
type: string
requestBody:
description: The document object with fields to be updated
content:
application/json:
schema:
$ref: "#/components/schemas/CollectionUpdateSchema"
required: true
responses:
'200':
description: The updated partial collection schema
content:
application/json:
schema:
$ref: "#/components/schemas/CollectionUpdateSchema"
'400':
description: Bad request, see error message for details
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
'404':
description: The collection was not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
delete:
tags:
- collections
summary: Delete a collection
description:
Permanently drops a collection. This action cannot be undone. For
large collections, this might have an impact on read latencies.
operationId: deleteCollection
parameters:
- name: collectionName
in: path
description: The name of the collection to delete
required: true
schema:
type: string
responses:
'200':
description: Collection deleted
content:
application/json:
schema:
$ref: "#/components/schemas/CollectionResponse"
'404':
description: Collection not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
/collections/{collectionName}/documents:
post:
tags:
- documents
summary: Index a document
description:
A document to be indexed in a given collection must conform to
the schema of the collection.
operationId: indexDocument
parameters:
- name: collectionName
in: path
description: The name of the collection to add the document to
required: true
schema:
type: string
- name: action
in: query
description: Additional action to perform
schema:
type: string
example: upsert
$ref: "#/components/schemas/IndexAction"
- name: dirty_values
in: query
description: Dealing with Dirty Data
schema:
$ref: "#/components/schemas/DirtyValues"
requestBody:
description: The document object to be indexed
content:
application/json:
schema:
type: object
description: Can be any key-value pair
x-go-type: "interface{}"
required: true
responses:
'201':
description: Document successfully created/indexed
content:
application/json:
schema:
type: object
description: Can be any key-value pair
'404':
description: Collection not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
patch:
tags:
- documents
summary: Update documents with conditional query
description:
The filter_by query parameter is used to filter to specify a condition against which the documents are matched.
The request body contains the fields that should be updated for any documents that match the filter condition.
This endpoint is only available if the Typesense server is version `0.25.0.rc12` or later.
operationId: updateDocuments
parameters:
- name: collectionName
in: path
description: The name of the collection to update documents in
required: true
schema:
type: string
- name: updateDocumentsParameters
in: query
schema:
type: object
properties:
filter_by:
type: string
example: "num_employees:>100 && country: [USA, UK]"
responses:
'200':
description:
The response contains a single field, `num_updated`, indicating the number of documents affected.
content:
application/json:
schema:
type: object
required:
- num_updated
properties:
num_updated:
type: integer
description: The number of documents that have been updated
example: 1
'400':
description: 'Bad request, see error message for details'
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
'404':
description: The collection was not found
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
requestBody:
description: The document fields to be updated
content:
application/json:
schema:
type: object
description: Can be any key-value pair
x-go-type: "interface{}"
required: true
delete:
tags:
- documents
summary: Delete a bunch of documents
description:
Delete a bunch of documents that match a specific filter condition.
Use the `batch_size` parameter to control the number of documents that
should deleted at a time. A larger value will speed up deletions, but will
impact performance of other operations running on the server.
operationId: deleteDocuments
parameters:
- name: collectionName
in: path
description: The name of the collection to delete documents from
required: true
schema:
type: string
- name: deleteDocumentsParameters
in: query
schema:
type: object
required:
- filter_by
properties:
filter_by:
type: string
example: "num_employees:>100 && country: [USA, UK]"
batch_size:
description:
Batch size parameter controls the number of documents that should be deleted
at a time. A larger value will speed up deletions, but will impact performance
of other operations running on the server.
type: integer
ignore_not_found:
type: boolean
responses:
'200':
description: Documents successfully deleted
content:
application/json:
schema:
type: object
required:
- num_deleted
properties:
num_deleted:
type: integer
'404':
description: Collection not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
/collections/{collectionName}/documents/search:
get:
tags:
- documents
summary: Search for documents in a collection
description: Search for documents in a collection that match the search criteria.
operationId: searchCollection
parameters:
- name: collectionName
in: path
description: The name of the collection to search for the document under
required: true
schema:
type: string
- name: searchParameters
required: true
in: query
schema:
$ref: "#/components/schemas/SearchParameters"
responses:
'200':
description: Search results
content:
application/json:
schema:
$ref: "#/components/schemas/SearchResult"
'400':
description: Bad request, see error message for details
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
'404':
description: The collection or field was not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
/collections/{collectionName}/overrides:
get:
tags:
- documents
- curation
summary: List all collection overrides
operationId: getSearchOverrides
parameters:
- name: collectionName
in: path
description: The name of the collection
required: true
schema:
type: string
responses:
'200':
description: List of all search overrides
content:
application/json:
schema:
$ref: "#/components/schemas/SearchOverridesResponse"
/collections/{collectionName}/overrides/{overrideId}:
get:
tags:
- documents
- override
summary: Retrieve a single search override
description: Retrieve the details of a search override, given its id.
operationId: getSearchOverride
parameters:
- name: collectionName
in: path
description: The name of the collection
required: true
schema:
type: string
- name: overrideId
in: path
description: The id of the search override
required: true
schema:
type: string
responses:
'200':
description: Search override fetched
content:
application/json:
schema:
$ref: "#/components/schemas/SearchOverride"
put:
tags:
- documents
- curation
summary: Create or update an override to promote certain documents over others
description:
Create or update an override to promote certain documents over others.
Using overrides, you can include or exclude specific documents for a given query.
operationId: upsertSearchOverride
parameters:
- name: collectionName
in: path
description: The name of the collection
required: true
schema:
type: string
- name: overrideId
in: path
description: The ID of the search override to create/update
required: true
schema:
type: string
requestBody:
description: The search override object to be created/updated
content:
application/json:
schema:
$ref: "#/components/schemas/SearchOverrideSchema"
required: true
responses:
'200':
description: Created/updated search override
content:
application/json:
schema:
$ref: "#/components/schemas/SearchOverride"
'404':
description: Search override not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
delete:
tags:
- documents
- curation
summary: Delete an override associated with a collection
operationId: deleteSearchOverride
parameters:
- name: collectionName
in: path
description: The name of the collection
required: true
schema:
type: string
- name: overrideId
in: path
description: The ID of the search override to delete
required: true
schema:
type: string
responses:
'200':
description: The ID of the deleted search override
content:
application/json:
schema:
$ref: "#/components/schemas/SearchOverrideDeleteResponse"
'404':
description: Search override not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
/collections/{collectionName}/synonyms:
get:
tags:
- synonyms
summary: List all collection synonyms
operationId: getSearchSynonyms
parameters:
- name: collectionName
in: path
description: The name of the collection
required: true
schema:
type: string
responses:
'200':
description: List of all search synonyms
content:
application/json:
schema:
$ref: "#/components/schemas/SearchSynonymsResponse"
'404':
description: Search synonyms was not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
/collections/{collectionName}/synonyms/{synonymId}:
get:
tags:
- synonyms
summary: Retrieve a single search synonym
description: Retrieve the details of a search synonym, given its id.
operationId: getSearchSynonym
parameters:
- name: collectionName
in: path
description: The name of the collection
required: true
schema:
type: string
- name: synonymId
in: path
description: The id of the search synonym
required: true
schema:
type: string
responses:
'200':
description: Search synonym fetched
content:
application/json:
schema:
$ref: "#/components/schemas/SearchSynonym"
'404':
description: Search synonym was not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
put:
tags:
- synonyms
summary: Create or update a synonym
description: Create or update a synonym to define search terms that should be considered equivalent.
operationId: upsertSearchSynonym
parameters:
- name: collectionName
in: path
description: The name of the collection
required: true
schema:
type: string
- name: synonymId
in: path
description: The ID of the search synonym to create/update
required: true
schema:
type: string
requestBody:
description: The search synonym object to be created/updated
content:
application/json:
schema:
$ref: "#/components/schemas/SearchSynonymSchema"
required: true
responses:
'200':
description: Created/updated search synonym
content:
application/json:
schema:
$ref: "#/components/schemas/SearchSynonym"
'404':
description: Search synonym was not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
delete:
tags:
- synonyms
summary: Delete a synonym associated with a collection
operationId: deleteSearchSynonym
parameters:
- name: collectionName
in: path
description: The name of the collection
required: true
schema:
type: string
- name: synonymId
in: path
description: The ID of the search synonym to delete
required: true
schema:
type: string
responses:
'200':
description: The ID of the deleted search synonym
content:
application/json:
schema:
$ref: "#/components/schemas/SearchSynonymDeleteResponse"
'404':
description: Search synonym not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
/collections/{collectionName}/documents/export:
get:
tags:
- documents
summary: Export all documents in a collection
description: Export all documents in a collection in JSON lines format.
operationId: exportDocuments
parameters:
- name: collectionName
in: path
description: The name of the collection
required: true
schema:
type: string
- name: exportDocumentsParameters
in: query
schema:
type: object
properties:
filter_by:
description:
Filter conditions for refining your search results. Separate
multiple conditions with &&.
type: string
include_fields:
description: List of fields from the document to include in the search result
type: string
exclude_fields:
description: List of fields from the document to exclude in the search result
type: string
responses:
'200':
description: Exports all the documents in a given collection.
content:
application/octet-stream:
schema:
type: string
example: |
{"id": "124", "company_name": "Stark Industries", "num_employees": 5215, "country": "US"}
{"id": "125", "company_name": "Future Technology", "num_employees": 1232,"country": "UK"}
{"id": "126", "company_name": "Random Corp.", "num_employees": 531,"country": "AU"}
'404':
description: The collection was not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
/collections/{collectionName}/documents/import:
post:
tags:
- documents
summary: Import documents into a collection
description:
The documents to be imported must be formatted in a newline delimited
JSON structure. You can feed the output file from a Typesense export operation
directly as import.
operationId: importDocuments
parameters:
- name: collectionName
in: path
description: The name of the collection
required: true
schema:
type: string
# Do not change the index position of this param
- name: importDocumentsParameters
in: query
schema:
type: object
properties:
batch_size:
type: integer
return_id:
type: boolean
description:
Returning the id of the imported documents. If you want the
import response to return the ingested document's id in the
response, you can use the return_id parameter.
remote_embedding_batch_size:
type: integer
return_doc:
type: boolean
action:
$ref: "#/components/schemas/IndexAction"
dirty_values:
$ref: "#/components/schemas/DirtyValues"
requestBody:
description: The json array of documents or the JSONL file to import
content:
application/octet-stream:
schema:
type: string
description: The JSONL file to import
required: true
responses:
'200':
description:
Result of the import operation. Each line of the response indicates the result
of each document present in the request body (in the same order). If the import
of a single document fails, it does not affect the other documents.
If there is a failure, the response line will include a corresponding error
message and as well as the actual document content.
content:
application/octet-stream:
schema:
type: string
example: |
{"success": true}
{"success": false, "error": "Bad JSON.", "document": "[bad doc"}
'400':
description: Bad request, see error message for details
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
'404':
description: The collection was not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
/collections/{collectionName}/documents/{documentId}:
get:
tags:
- documents
summary: Retreive a document
description: Fetch an individual document from a collection by using its ID.
operationId: getDocument
parameters:
- name: collectionName
in: path
description: The name of the collection to search for the document under
required: true
schema:
type: string
- name: documentId
in: path
description: The Document ID
required: true
schema:
type: string
responses:
'200':
description: The document referenced by the ID
content:
application/json:
schema:
type: object
description: Can be any key-value pair
'404':
description: The document or collection was not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
patch:
tags:
- documents
summary: Update a document
description:
Update an individual document from a collection by using its ID.
The update can be partial.
operationId: updateDocument
parameters:
- name: collectionName
in: path
description: The name of the collection to search for the document under
required: true
schema:
type: string
- name: documentId
in: path
description: The Document ID
required: true
schema:
type: string
- name: dirty_values
in: query
description: Dealing with Dirty Data
schema:
$ref: "#/components/schemas/DirtyValues"
requestBody:
description: The document object with fields to be updated
content:
application/json:
schema:
type: object
description: Can be any key-value pair
x-go-type: "interface{}"
required: true
responses:
'200':
description: The document referenced by the ID was updated
content:
application/json:
schema:
type: object
description: Can be any key-value pair
'404':
description: The document or collection was not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
delete:
tags:
- documents
summary: Delete a document
description: Delete an individual document from a collection by using its ID.
operationId: deleteDocument
parameters:
- name: collectionName
in: path
description: The name of the collection to search for the document under
required: true
schema:
type: string
- name: documentId
in: path
description: The Document ID
required: true
schema:
type: string
responses:
'200':
description: The document referenced by the ID was deleted
content:
application/json:
schema:
type: object
description: Can be any key-value pair
'404':
description: The document or collection was not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
/conversations/models:
get:
description: Retrieve all conversation models
operationId: retrieveAllConversationModels
responses:
'200':
content:
application/json:
schema:
items:
$ref: '#/components/schemas/ConversationModelSchema'
type: array
x-go-type: '[]*ConversationModelSchema'
description: List of all conversation models
summary: List all conversation models
tags:
- conversations
post:
description: Create a Conversation Model
operationId: createConversationModel
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ConversationModelCreateSchema'
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ConversationModelSchema'
description: Created Conversation Model
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
description: Bad request, see error message for details
tags:
- conversations
/conversations/models/{modelId}:
get:
description: Retrieve a conversation model
operationId: retrieveConversationModel
parameters:
- name: modelId
in: path
description: The id of the conversation model to retrieve
required: true
schema:
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ConversationModelSchema'
description: A conversation model
summary: Retrieve a conversation model
tags:
- conversations
put:
description: Update a conversation model
operationId: updateConversationModel
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ConversationModelUpdateSchema'
required: true
parameters:
- name: modelId
in: path
description: The id of the conversation model to update
required: true
schema:
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ConversationModelSchema'
description: The conversation model was successfully updated
summary: Update a conversation model
tags:
- conversations
delete:
description: Delete a conversation model
operationId: deleteConversationModel
parameters:
- name: modelId
in: path