meilisearch-python-sdk 3.5.0__py3-none-any.whl → 3.6.0__py3-none-any.whl
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.
Potentially problematic release.
This version of meilisearch-python-sdk might be problematic. Click here for more details.
- meilisearch_python_sdk/_client.py +67 -244
- meilisearch_python_sdk/_task.py +1 -5
- meilisearch_python_sdk/_version.py +1 -1
- meilisearch_python_sdk/decorators.py +2 -10
- meilisearch_python_sdk/index.py +272 -966
- meilisearch_python_sdk/models/search.py +14 -1
- meilisearch_python_sdk/models/settings.py +8 -4
- {meilisearch_python_sdk-3.5.0.dist-info → meilisearch_python_sdk-3.6.0.dist-info}/METADATA +3 -2
- {meilisearch_python_sdk-3.5.0.dist-info → meilisearch_python_sdk-3.6.0.dist-info}/RECORD +11 -11
- {meilisearch_python_sdk-3.5.0.dist-info → meilisearch_python_sdk-3.6.0.dist-info}/WHEEL +0 -0
- {meilisearch_python_sdk-3.5.0.dist-info → meilisearch_python_sdk-3.6.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -24,6 +24,7 @@ from meilisearch_python_sdk.models.health import Health
|
|
|
24
24
|
from meilisearch_python_sdk.models.index import IndexInfo
|
|
25
25
|
from meilisearch_python_sdk.models.search import (
|
|
26
26
|
Federation,
|
|
27
|
+
FederationMerged,
|
|
27
28
|
SearchParams,
|
|
28
29
|
SearchResultsFederated,
|
|
29
30
|
SearchResultsWithUID,
|
|
@@ -74,7 +75,6 @@ class BaseClient:
|
|
|
74
75
|
"""Generates a JWT token to use for searching.
|
|
75
76
|
|
|
76
77
|
Args:
|
|
77
|
-
|
|
78
78
|
search_rules: Contains restrictions to use for the token. The default rules used for
|
|
79
79
|
the API key used for signing can be used by setting searchRules to ["*"]. If "indexes"
|
|
80
80
|
is included it must be equal to or more restrictive than the key used to generate the
|
|
@@ -84,17 +84,14 @@ class BaseClient:
|
|
|
84
84
|
shoud be a UTC time in the future. Default = None.
|
|
85
85
|
|
|
86
86
|
Returns:
|
|
87
|
-
|
|
88
87
|
A JWT token
|
|
89
88
|
|
|
90
89
|
Raises:
|
|
91
|
-
|
|
92
90
|
InvalidRestriction: If the restrictions are less strict than the permissions allowed
|
|
93
91
|
in the API key.
|
|
94
92
|
KeyNotFoundError: If no API search key is found.
|
|
95
93
|
|
|
96
94
|
Examples:
|
|
97
|
-
|
|
98
95
|
Async:
|
|
99
96
|
|
|
100
97
|
>>> from datetime import datetime, timedelta, timezone
|
|
@@ -155,7 +152,6 @@ class AsyncClient(BaseClient):
|
|
|
155
152
|
"""Class initializer.
|
|
156
153
|
|
|
157
154
|
Args:
|
|
158
|
-
|
|
159
155
|
url: The url to the Meilisearch API (ex: http://localhost:7700)
|
|
160
156
|
api_key: The optional API key for Meilisearch. Defaults to None.
|
|
161
157
|
timeout: The amount of time in seconds that the client will wait for a response before
|
|
@@ -200,16 +196,13 @@ class AsyncClient(BaseClient):
|
|
|
200
196
|
"""Trigger the creation of a Meilisearch dump.
|
|
201
197
|
|
|
202
198
|
Returns:
|
|
203
|
-
|
|
204
199
|
The details of the task.
|
|
205
200
|
|
|
206
201
|
Raises:
|
|
207
|
-
|
|
208
202
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
209
203
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
210
204
|
|
|
211
205
|
Examples:
|
|
212
|
-
|
|
213
206
|
>>> from meilisearch_python_sdk import AsyncClient
|
|
214
207
|
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
215
208
|
>>> await client.create_dump()
|
|
@@ -232,7 +225,6 @@ class AsyncClient(BaseClient):
|
|
|
232
225
|
"""Creates a new index.
|
|
233
226
|
|
|
234
227
|
Args:
|
|
235
|
-
|
|
236
228
|
uid: The index's unique identifier.
|
|
237
229
|
primary_key: The primary key of the documents. Defaults to None.
|
|
238
230
|
settings: Settings for the index. The settings can also be updated independently of
|
|
@@ -251,16 +243,13 @@ class AsyncClient(BaseClient):
|
|
|
251
243
|
JsonDict
|
|
252
244
|
|
|
253
245
|
Returns:
|
|
254
|
-
|
|
255
246
|
An instance of AsyncIndex containing the information of the newly created index.
|
|
256
247
|
|
|
257
248
|
Raises:
|
|
258
|
-
|
|
259
249
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
260
250
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
261
251
|
|
|
262
252
|
Examples:
|
|
263
|
-
|
|
264
253
|
>>> from meilisearch_python_sdk import AsyncClient
|
|
265
254
|
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
266
255
|
>>> index = await client.create_index("movies")
|
|
@@ -281,16 +270,13 @@ class AsyncClient(BaseClient):
|
|
|
281
270
|
"""Trigger the creation of a Meilisearch snapshot.
|
|
282
271
|
|
|
283
272
|
Returns:
|
|
284
|
-
|
|
285
273
|
The details of the task.
|
|
286
274
|
|
|
287
275
|
Raises:
|
|
288
|
-
|
|
289
276
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
290
277
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
291
278
|
|
|
292
279
|
Examples:
|
|
293
|
-
|
|
294
280
|
>>> from meilisearch_python_sdk import AsyncClient
|
|
295
281
|
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
296
282
|
>>> await client.create_snapshot()
|
|
@@ -303,20 +289,16 @@ class AsyncClient(BaseClient):
|
|
|
303
289
|
"""Deletes an index if it already exists.
|
|
304
290
|
|
|
305
291
|
Args:
|
|
306
|
-
|
|
307
292
|
uid: The index's unique identifier.
|
|
308
293
|
|
|
309
294
|
Returns:
|
|
310
|
-
|
|
311
295
|
True if an index was deleted for False if not.
|
|
312
296
|
|
|
313
297
|
Raises:
|
|
314
|
-
|
|
315
298
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
316
299
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
317
300
|
|
|
318
301
|
Examples:
|
|
319
|
-
|
|
320
302
|
>>> from meilisearch_python_sdk import AsyncClient
|
|
321
303
|
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
322
304
|
>>> await client.delete_index_if_exists()
|
|
@@ -331,24 +313,21 @@ class AsyncClient(BaseClient):
|
|
|
331
313
|
self, *, offset: int | None = None, limit: int | None = None
|
|
332
314
|
) -> list[AsyncIndex] | None:
|
|
333
315
|
"""Get all indexes.
|
|
334
|
-
Args:
|
|
335
316
|
|
|
317
|
+
Args:
|
|
336
318
|
offset: Number of indexes to skip. The default of None will use the Meilisearch
|
|
337
319
|
default.
|
|
338
320
|
limit: Number of indexes to return. The default of None will use the Meilisearch
|
|
339
321
|
default.
|
|
340
322
|
|
|
341
323
|
Returns:
|
|
342
|
-
|
|
343
324
|
A list of all indexes.
|
|
344
325
|
|
|
345
326
|
Raises:
|
|
346
|
-
|
|
347
327
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
348
328
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
349
329
|
|
|
350
330
|
Examples:
|
|
351
|
-
|
|
352
331
|
>>> from meilisearch_python_sdk import AsyncClient
|
|
353
332
|
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
354
333
|
>>> indexes = await client.get_indexes()
|
|
@@ -375,20 +354,16 @@ class AsyncClient(BaseClient):
|
|
|
375
354
|
"""Gets a single index based on the uid of the index.
|
|
376
355
|
|
|
377
356
|
Args:
|
|
378
|
-
|
|
379
357
|
uid: The index's unique identifier.
|
|
380
358
|
|
|
381
359
|
Returns:
|
|
382
|
-
|
|
383
360
|
An AsyncIndex instance containing the information of the fetched index.
|
|
384
361
|
|
|
385
362
|
Raises:
|
|
386
|
-
|
|
387
363
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
388
364
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
389
365
|
|
|
390
366
|
Examples:
|
|
391
|
-
|
|
392
367
|
>>> from meilisearch_python_sdk import AsyncClient
|
|
393
368
|
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
394
369
|
>>> index = await client.get_index()
|
|
@@ -401,21 +376,17 @@ class AsyncClient(BaseClient):
|
|
|
401
376
|
Because no network call is made this method is not awaitable.
|
|
402
377
|
|
|
403
378
|
Args:
|
|
404
|
-
|
|
405
379
|
uid: The index's unique identifier.
|
|
406
380
|
plugins: Optional plugins can be provided to extend functionality.
|
|
407
381
|
|
|
408
382
|
Returns:
|
|
409
|
-
|
|
410
383
|
An AsyncIndex instance.
|
|
411
384
|
|
|
412
385
|
Raises:
|
|
413
|
-
|
|
414
386
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
415
387
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
416
388
|
|
|
417
389
|
Examples:
|
|
418
|
-
|
|
419
390
|
>>> from meilisearch_python_sdk import AsyncClient
|
|
420
391
|
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
421
392
|
>>> index = client.index("movies")
|
|
@@ -428,17 +399,14 @@ class AsyncClient(BaseClient):
|
|
|
428
399
|
"""Get stats for all indexes.
|
|
429
400
|
|
|
430
401
|
Returns:
|
|
431
|
-
|
|
432
402
|
Information about database size and all indexes.
|
|
433
403
|
https://docs.meilisearch.com/reference/api/stats.html
|
|
434
404
|
|
|
435
405
|
Raises:
|
|
436
|
-
|
|
437
406
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
438
407
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
439
408
|
|
|
440
|
-
Examples
|
|
441
|
-
|
|
409
|
+
Examples
|
|
442
410
|
>>> from meilisearch_python_sdk import AsyncClient
|
|
443
411
|
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
444
412
|
>>> stats = await client.get_all_stats()
|
|
@@ -458,7 +426,6 @@ class AsyncClient(BaseClient):
|
|
|
458
426
|
"""Get an index, or create it if it doesn't exist.
|
|
459
427
|
|
|
460
428
|
Args:
|
|
461
|
-
|
|
462
429
|
uid: The index's unique identifier.
|
|
463
430
|
primary_key: The primary key of the documents. Defaults to None.
|
|
464
431
|
plugins: Optional plugins can be provided to extend functionality.
|
|
@@ -466,17 +433,14 @@ class AsyncClient(BaseClient):
|
|
|
466
433
|
JsonDict
|
|
467
434
|
|
|
468
435
|
Returns:
|
|
469
|
-
|
|
470
436
|
An instance of AsyncIndex containing the information of the retrieved or newly created index.
|
|
471
437
|
|
|
472
438
|
Raises:
|
|
473
|
-
|
|
474
439
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
475
440
|
MeilisearchApiError: If the Meilisearch API returned an error.MeilisearchTimeoutError: If the connection times out.
|
|
476
441
|
MeilisearchTimeoutError: If the connection times out.
|
|
477
442
|
|
|
478
|
-
Examples
|
|
479
|
-
|
|
443
|
+
Examples
|
|
480
444
|
>>> from meilisearch_python_sdk import AsyncClient
|
|
481
445
|
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
482
446
|
>>> index = await client.get_or_create_index("movies")
|
|
@@ -495,21 +459,17 @@ class AsyncClient(BaseClient):
|
|
|
495
459
|
"""Creates a new API key.
|
|
496
460
|
|
|
497
461
|
Args:
|
|
498
|
-
|
|
499
462
|
key: The information to use in creating the key. Note that if an expires_at value
|
|
500
463
|
is included it should be in UTC time.
|
|
501
464
|
|
|
502
465
|
Returns:
|
|
503
|
-
|
|
504
466
|
The new API key.
|
|
505
467
|
|
|
506
468
|
Raises:
|
|
507
|
-
|
|
508
469
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
509
470
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
510
471
|
|
|
511
|
-
Examples
|
|
512
|
-
|
|
472
|
+
Examples
|
|
513
473
|
>>> from meilisearch_python_sdk import AsyncClient
|
|
514
474
|
>>> from meilissearch_async_client.models.client import KeyCreate
|
|
515
475
|
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
@@ -530,20 +490,16 @@ class AsyncClient(BaseClient):
|
|
|
530
490
|
"""Deletes an API key.
|
|
531
491
|
|
|
532
492
|
Args:
|
|
533
|
-
|
|
534
493
|
key: The key or uid to delete.
|
|
535
494
|
|
|
536
495
|
Returns:
|
|
537
|
-
|
|
538
496
|
The Response status code. 204 signifies a successful delete.
|
|
539
497
|
|
|
540
498
|
Raises:
|
|
541
|
-
|
|
542
499
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
543
500
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
544
501
|
|
|
545
|
-
Examples
|
|
546
|
-
|
|
502
|
+
Examples
|
|
547
503
|
>>> from meilisearch_python_sdk import AsyncClient
|
|
548
504
|
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
549
505
|
>>> await client.delete_key("abc123")
|
|
@@ -553,24 +509,21 @@ class AsyncClient(BaseClient):
|
|
|
553
509
|
|
|
554
510
|
async def get_keys(self, *, offset: int | None = None, limit: int | None = None) -> KeySearch:
|
|
555
511
|
"""Gets the Meilisearch API keys.
|
|
556
|
-
Args:
|
|
557
512
|
|
|
513
|
+
Args:
|
|
558
514
|
offset: Number of indexes to skip. The default of None will use the Meilisearch
|
|
559
515
|
default.
|
|
560
516
|
limit: Number of indexes to return. The default of None will use the Meilisearch
|
|
561
517
|
default.
|
|
562
518
|
|
|
563
519
|
Returns:
|
|
564
|
-
|
|
565
520
|
API keys.
|
|
566
521
|
|
|
567
522
|
Raises:
|
|
568
|
-
|
|
569
523
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
570
524
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
571
525
|
|
|
572
|
-
Examples
|
|
573
|
-
|
|
526
|
+
Examples
|
|
574
527
|
from meilisearch_python_sdk import AsyncClient
|
|
575
528
|
async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
576
529
|
keys = await client.get_keys()
|
|
@@ -584,20 +537,16 @@ class AsyncClient(BaseClient):
|
|
|
584
537
|
"""Gets information about a specific API key.
|
|
585
538
|
|
|
586
539
|
Args:
|
|
587
|
-
|
|
588
540
|
key: The key for which to retrieve the information.
|
|
589
541
|
|
|
590
542
|
Returns:
|
|
591
|
-
|
|
592
543
|
The API key, or `None` if the key is not found.
|
|
593
544
|
|
|
594
545
|
Raises:
|
|
595
|
-
|
|
596
546
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
597
547
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
598
548
|
|
|
599
|
-
Examples
|
|
600
|
-
|
|
549
|
+
Examples
|
|
601
550
|
>>> from meilisearch_python_sdk import AsyncClient
|
|
602
551
|
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
603
552
|
>>> keys = await client.get_key("abc123")
|
|
@@ -610,21 +559,17 @@ class AsyncClient(BaseClient):
|
|
|
610
559
|
"""Update an API key.
|
|
611
560
|
|
|
612
561
|
Args:
|
|
613
|
-
|
|
614
562
|
key: The information to use in updating the key. Note that if an expires_at value
|
|
615
563
|
is included it should be in UTC time.
|
|
616
564
|
|
|
617
565
|
Returns:
|
|
618
|
-
|
|
619
566
|
The updated API key.
|
|
620
567
|
|
|
621
568
|
Raises:
|
|
622
|
-
|
|
623
569
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
624
570
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
625
571
|
|
|
626
|
-
Examples
|
|
627
|
-
|
|
572
|
+
Examples
|
|
628
573
|
>>> from meilisearch_python_sdk import AsyncClient
|
|
629
574
|
>>> from meilissearch_async_client.models.client import KeyUpdate
|
|
630
575
|
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
@@ -643,13 +588,12 @@ class AsyncClient(BaseClient):
|
|
|
643
588
|
self,
|
|
644
589
|
queries: list[SearchParams],
|
|
645
590
|
*,
|
|
646
|
-
federation: Federation | None = None,
|
|
591
|
+
federation: Federation | FederationMerged | None = None,
|
|
647
592
|
hits_type: Any = JsonDict,
|
|
648
593
|
) -> list[SearchResultsWithUID] | SearchResultsFederated:
|
|
649
594
|
"""Multi-index search.
|
|
650
595
|
|
|
651
596
|
Args:
|
|
652
|
-
|
|
653
597
|
queries: List of SearchParameters
|
|
654
598
|
federation: If included a single search result with hits built from all queries will
|
|
655
599
|
be returned. This parameter can only be used with Meilisearch >= v1.10.0. Defaults
|
|
@@ -658,16 +602,13 @@ class AsyncClient(BaseClient):
|
|
|
658
602
|
JsonDict
|
|
659
603
|
|
|
660
604
|
Returns:
|
|
661
|
-
|
|
662
605
|
Results of the search
|
|
663
606
|
|
|
664
607
|
Raises:
|
|
665
|
-
|
|
666
608
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
667
609
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
668
610
|
|
|
669
|
-
Examples
|
|
670
|
-
|
|
611
|
+
Examples
|
|
671
612
|
>>> from meilisearch_python_sdk import AsyncClient
|
|
672
613
|
>>> from meilisearch_python_sdk.models.search import SearchParams
|
|
673
614
|
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
@@ -688,10 +629,18 @@ class AsyncClient(BaseClient):
|
|
|
688
629
|
else:
|
|
689
630
|
processed_queries = [x.model_dump(by_alias=True) for x in queries]
|
|
690
631
|
|
|
632
|
+
if federation:
|
|
633
|
+
federation_payload = federation.model_dump(by_alias=True)
|
|
634
|
+
if federation.facets_by_index is None:
|
|
635
|
+
del federation_payload["facetsByIndex"]
|
|
636
|
+
|
|
637
|
+
else:
|
|
638
|
+
federation_payload = None
|
|
639
|
+
|
|
691
640
|
response = await self._http_requests.post(
|
|
692
641
|
url,
|
|
693
642
|
body={
|
|
694
|
-
"federation":
|
|
643
|
+
"federation": federation_payload,
|
|
695
644
|
"queries": processed_queries,
|
|
696
645
|
},
|
|
697
646
|
)
|
|
@@ -706,20 +655,16 @@ class AsyncClient(BaseClient):
|
|
|
706
655
|
"""Gets the index and returns all the index information rather than an AsyncIndex instance.
|
|
707
656
|
|
|
708
657
|
Args:
|
|
709
|
-
|
|
710
658
|
uid: The index's unique identifier.
|
|
711
659
|
|
|
712
660
|
Returns:
|
|
713
|
-
|
|
714
661
|
Index information rather than an AsyncIndex instance.
|
|
715
662
|
|
|
716
663
|
Raises:
|
|
717
|
-
|
|
718
664
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
719
665
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
720
666
|
|
|
721
|
-
Examples
|
|
722
|
-
|
|
667
|
+
Examples
|
|
723
668
|
>>> from meilisearch_python_sdk import AsyncClient
|
|
724
669
|
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
725
670
|
>>> index = await client.get_raw_index("movies")
|
|
@@ -735,8 +680,8 @@ class AsyncClient(BaseClient):
|
|
|
735
680
|
self, *, offset: int | None = None, limit: int | None = None
|
|
736
681
|
) -> list[IndexInfo] | None:
|
|
737
682
|
"""Gets all the indexes.
|
|
738
|
-
Args:
|
|
739
683
|
|
|
684
|
+
Args:
|
|
740
685
|
offset: Number of indexes to skip. The default of None will use the Meilisearch
|
|
741
686
|
default.
|
|
742
687
|
limit: Number of indexes to return. The default of None will use the Meilisearch
|
|
@@ -745,16 +690,13 @@ class AsyncClient(BaseClient):
|
|
|
745
690
|
Returns all the index information rather than an AsyncIndex instance.
|
|
746
691
|
|
|
747
692
|
Returns:
|
|
748
|
-
|
|
749
693
|
A list of the Index information rather than an AsyncIndex instances.
|
|
750
694
|
|
|
751
695
|
Raises:
|
|
752
|
-
|
|
753
696
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
754
697
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
755
698
|
|
|
756
|
-
Examples
|
|
757
|
-
|
|
699
|
+
Examples
|
|
758
700
|
>>> from meilisearch_python_sdk import AsyncClient
|
|
759
701
|
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
760
702
|
>>> index = await client.get_raw_indexes()
|
|
@@ -771,16 +713,13 @@ class AsyncClient(BaseClient):
|
|
|
771
713
|
"""Get the Meilisearch version.
|
|
772
714
|
|
|
773
715
|
Returns:
|
|
774
|
-
|
|
775
716
|
Information about the version of Meilisearch.
|
|
776
717
|
|
|
777
718
|
Raises:
|
|
778
|
-
|
|
779
719
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
780
720
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
781
721
|
|
|
782
|
-
Examples
|
|
783
|
-
|
|
722
|
+
Examples
|
|
784
723
|
>>> from meilisearch_python_sdk import AsyncClient
|
|
785
724
|
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
786
725
|
>>> version = await client.get_version()
|
|
@@ -793,16 +732,13 @@ class AsyncClient(BaseClient):
|
|
|
793
732
|
"""Get health of the Meilisearch server.
|
|
794
733
|
|
|
795
734
|
Returns:
|
|
796
|
-
|
|
797
735
|
The status of the Meilisearch server.
|
|
798
736
|
|
|
799
737
|
Raises:
|
|
800
|
-
|
|
801
738
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
802
739
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
803
740
|
|
|
804
|
-
Examples
|
|
805
|
-
|
|
741
|
+
Examples
|
|
806
742
|
>>> from meilisearch_python_sdk import AsyncClient
|
|
807
743
|
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
808
744
|
>>> health = await client.get_health()
|
|
@@ -815,20 +751,16 @@ class AsyncClient(BaseClient):
|
|
|
815
751
|
"""Swap two indexes.
|
|
816
752
|
|
|
817
753
|
Args:
|
|
818
|
-
|
|
819
754
|
indexes: A list of tuples, each tuple should contain the indexes to swap.
|
|
820
755
|
|
|
821
756
|
Returns:
|
|
822
|
-
|
|
823
757
|
The details of the task.
|
|
824
758
|
|
|
825
759
|
Raises:
|
|
826
|
-
|
|
827
760
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
828
761
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
829
762
|
|
|
830
|
-
Examples
|
|
831
|
-
|
|
763
|
+
Examples
|
|
832
764
|
>>> from meilisearch_python_sdk import AsyncClient
|
|
833
765
|
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
834
766
|
>>> index = await client.swap_indexes([("index_a", "index_b")])
|
|
@@ -855,7 +787,6 @@ class AsyncClient(BaseClient):
|
|
|
855
787
|
Defaults to cancelling all tasks.
|
|
856
788
|
|
|
857
789
|
Args:
|
|
858
|
-
|
|
859
790
|
uids: A list of task UIDs to cancel.
|
|
860
791
|
index_uids: A list of index UIDs for which to cancel tasks.
|
|
861
792
|
statuses: A list of statuses to cancel.
|
|
@@ -866,17 +797,14 @@ class AsyncClient(BaseClient):
|
|
|
866
797
|
after_finished_at: Cancel tasks that were finished after the specified date time.
|
|
867
798
|
|
|
868
799
|
Returns:
|
|
869
|
-
|
|
870
800
|
The details of the task
|
|
871
801
|
|
|
872
802
|
Raises:
|
|
873
|
-
|
|
874
803
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
875
804
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
876
805
|
MeilisearchTimeoutError: If the connection times out.
|
|
877
806
|
|
|
878
|
-
Examples
|
|
879
|
-
|
|
807
|
+
Examples
|
|
880
808
|
>>> from meilisearch_python_sdk import AsyncClient
|
|
881
809
|
>>>
|
|
882
810
|
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
@@ -898,21 +826,17 @@ class AsyncClient(BaseClient):
|
|
|
898
826
|
"""Get a single task from it's task id.
|
|
899
827
|
|
|
900
828
|
Args:
|
|
901
|
-
|
|
902
829
|
task_id: Identifier of the task to retrieve.
|
|
903
830
|
|
|
904
831
|
Returns:
|
|
905
|
-
|
|
906
832
|
Results of a task.
|
|
907
833
|
|
|
908
834
|
Raises:
|
|
909
|
-
|
|
910
835
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
911
836
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
912
837
|
MeilisearchTimeoutError: If the connection times out.
|
|
913
838
|
|
|
914
|
-
Examples
|
|
915
|
-
|
|
839
|
+
Examples
|
|
916
840
|
>>> from meilisearch_python_sdk import AsyncClient
|
|
917
841
|
>>> from meilisearch_python_sdk.task import get_task
|
|
918
842
|
>>>
|
|
@@ -938,7 +862,6 @@ class AsyncClient(BaseClient):
|
|
|
938
862
|
Defaults to deleting all tasks.
|
|
939
863
|
|
|
940
864
|
Args:
|
|
941
|
-
|
|
942
865
|
uids: A list of task UIDs to delete.
|
|
943
866
|
index_uids: A list of index UIDs for which to delete tasks.
|
|
944
867
|
statuses: A list of statuses to delete.
|
|
@@ -949,17 +872,14 @@ class AsyncClient(BaseClient):
|
|
|
949
872
|
after_finished_at: Delete tasks that were finished after the specified date time.
|
|
950
873
|
|
|
951
874
|
Returns:
|
|
952
|
-
|
|
953
875
|
The details of the task
|
|
954
876
|
|
|
955
877
|
Raises:
|
|
956
|
-
|
|
957
878
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
958
879
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
959
880
|
MeilisearchTimeoutError: If the connection times out.
|
|
960
881
|
|
|
961
|
-
Examples
|
|
962
|
-
|
|
882
|
+
Examples
|
|
963
883
|
>>> from meilisearch_python_sdk import AsyncClient
|
|
964
884
|
>>> from meilisearch_python_sdk.task import delete_tasks
|
|
965
885
|
>>>
|
|
@@ -987,23 +907,19 @@ class AsyncClient(BaseClient):
|
|
|
987
907
|
"""Get multiple tasks.
|
|
988
908
|
|
|
989
909
|
Args:
|
|
990
|
-
|
|
991
910
|
index_ids: A list of index UIDs for which to get the tasks. If provided this will get the
|
|
992
911
|
tasks only for the specified indexes, if not all tasks will be returned. Default = None
|
|
993
912
|
types: Specify specific task types to retrieve. Default = None
|
|
994
913
|
|
|
995
914
|
Returns:
|
|
996
|
-
|
|
997
915
|
Task statuses.
|
|
998
916
|
|
|
999
917
|
Raises:
|
|
1000
|
-
|
|
1001
918
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1002
919
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1003
920
|
MeilisearchTimeoutError: If the connection times out.
|
|
1004
921
|
|
|
1005
|
-
Examples
|
|
1006
|
-
|
|
922
|
+
Examples
|
|
1007
923
|
>>> from meilisearch_python_sdk import AsyncClient
|
|
1008
924
|
>>>
|
|
1009
925
|
>>> async with AsyncClient("http://localhost.com", "masterKey") as client:
|
|
@@ -1022,7 +938,6 @@ class AsyncClient(BaseClient):
|
|
|
1022
938
|
"""Wait until Meilisearch processes a task, and get its status.
|
|
1023
939
|
|
|
1024
940
|
Args:
|
|
1025
|
-
|
|
1026
941
|
task_id: Identifier of the task to retrieve.
|
|
1027
942
|
timeout_in_ms: Amount of time in milliseconds to wait before raising a
|
|
1028
943
|
MeilisearchTimeoutError. `None` can also be passed to wait indefinitely. Be aware that
|
|
@@ -1032,18 +947,15 @@ class AsyncClient(BaseClient):
|
|
|
1032
947
|
has a failed status. Defaults to False.
|
|
1033
948
|
|
|
1034
949
|
Returns:
|
|
1035
|
-
|
|
1036
950
|
Details of the processed update status.
|
|
1037
951
|
|
|
1038
952
|
Raises:
|
|
1039
|
-
|
|
1040
953
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1041
954
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1042
955
|
MeilisearchTimeoutError: If the connection times out.
|
|
1043
956
|
MeilisearchTaskFailedError: If `raise_for_status` is `True` and a task has a failed status.
|
|
1044
957
|
|
|
1045
|
-
Examples
|
|
1046
|
-
|
|
958
|
+
Examples
|
|
1047
959
|
>>> from meilisearch_python_sdk import AsyncClient
|
|
1048
960
|
>>> >>> documents = [
|
|
1049
961
|
>>> {"id": 1, "title": "Movie 1", "genre": "comedy"},
|
|
@@ -1080,7 +992,6 @@ class Client(BaseClient):
|
|
|
1080
992
|
"""Class initializer.
|
|
1081
993
|
|
|
1082
994
|
Args:
|
|
1083
|
-
|
|
1084
995
|
url: The url to the Meilisearch API (ex: http://localhost:7700)
|
|
1085
996
|
api_key: The optional API key for Meilisearch. Defaults to None.
|
|
1086
997
|
timeout: The amount of time in seconds that the client will wait for a response before
|
|
@@ -1108,16 +1019,13 @@ class Client(BaseClient):
|
|
|
1108
1019
|
"""Trigger the creation of a Meilisearch dump.
|
|
1109
1020
|
|
|
1110
1021
|
Returns:
|
|
1111
|
-
|
|
1112
1022
|
The details of the task.
|
|
1113
1023
|
|
|
1114
1024
|
Raises:
|
|
1115
|
-
|
|
1116
1025
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1117
1026
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1118
1027
|
|
|
1119
|
-
Examples
|
|
1120
|
-
|
|
1028
|
+
Examples
|
|
1121
1029
|
>>> from meilisearch_python_sdk import Client
|
|
1122
1030
|
>>> client = Client("http://localhost.com", "masterKey")
|
|
1123
1031
|
>>> client.create_dump()
|
|
@@ -1140,7 +1048,6 @@ class Client(BaseClient):
|
|
|
1140
1048
|
"""Creates a new index.
|
|
1141
1049
|
|
|
1142
1050
|
Args:
|
|
1143
|
-
|
|
1144
1051
|
uid: The index's unique identifier.
|
|
1145
1052
|
primary_key: The primary key of the documents. Defaults to None.
|
|
1146
1053
|
settings: Settings for the index. The settings can also be updated independently of
|
|
@@ -1159,16 +1066,13 @@ class Client(BaseClient):
|
|
|
1159
1066
|
JsonDict
|
|
1160
1067
|
|
|
1161
1068
|
Returns:
|
|
1162
|
-
|
|
1163
1069
|
An instance of Index containing the information of the newly created index.
|
|
1164
1070
|
|
|
1165
1071
|
Raises:
|
|
1166
|
-
|
|
1167
1072
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1168
1073
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1169
1074
|
|
|
1170
|
-
Examples
|
|
1171
|
-
|
|
1075
|
+
Examples
|
|
1172
1076
|
>>> from meilisearch_python_sdk import Client
|
|
1173
1077
|
>>> client = Client("http://localhost.com", "masterKey")
|
|
1174
1078
|
>>> index = client.create_index("movies")
|
|
@@ -1189,16 +1093,13 @@ class Client(BaseClient):
|
|
|
1189
1093
|
"""Trigger the creation of a Meilisearch snapshot.
|
|
1190
1094
|
|
|
1191
1095
|
Returns:
|
|
1192
|
-
|
|
1193
1096
|
The details of the task.
|
|
1194
1097
|
|
|
1195
1098
|
Raises:
|
|
1196
|
-
|
|
1197
1099
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1198
1100
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1199
1101
|
|
|
1200
|
-
Examples
|
|
1201
|
-
|
|
1102
|
+
Examples
|
|
1202
1103
|
>>> from meilisearch_python_sdk import Client
|
|
1203
1104
|
>>> client = Client("http://localhost.com", "masterKey")
|
|
1204
1105
|
>>> client.create_snapshot()
|
|
@@ -1211,20 +1112,16 @@ class Client(BaseClient):
|
|
|
1211
1112
|
"""Deletes an index if it already exists.
|
|
1212
1113
|
|
|
1213
1114
|
Args:
|
|
1214
|
-
|
|
1215
1115
|
uid: The index's unique identifier.
|
|
1216
1116
|
|
|
1217
1117
|
Returns:
|
|
1218
|
-
|
|
1219
1118
|
True if an index was deleted for False if not.
|
|
1220
1119
|
|
|
1221
1120
|
Raises:
|
|
1222
|
-
|
|
1223
1121
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1224
1122
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1225
1123
|
|
|
1226
|
-
Examples
|
|
1227
|
-
|
|
1124
|
+
Examples
|
|
1228
1125
|
>>> from meilisearch_python_sdk import Client
|
|
1229
1126
|
>>> client = Client("http://localhost.com", "masterKey")
|
|
1230
1127
|
>>> client.delete_index_if_exists()
|
|
@@ -1240,23 +1137,19 @@ class Client(BaseClient):
|
|
|
1240
1137
|
) -> list[Index] | None:
|
|
1241
1138
|
"""Get all indexes.
|
|
1242
1139
|
Args:
|
|
1243
|
-
|
|
1244
1140
|
offset: Number of indexes to skip. The default of None will use the Meilisearch
|
|
1245
1141
|
default.
|
|
1246
1142
|
limit: Number of indexes to return. The default of None will use the Meilisearch
|
|
1247
1143
|
default.
|
|
1248
1144
|
|
|
1249
1145
|
Returns:
|
|
1250
|
-
|
|
1251
1146
|
A list of all indexes.
|
|
1252
1147
|
|
|
1253
1148
|
Raises:
|
|
1254
|
-
|
|
1255
1149
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1256
1150
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1257
1151
|
|
|
1258
|
-
Examples
|
|
1259
|
-
|
|
1152
|
+
Examples
|
|
1260
1153
|
>>> from meilisearch_python_sdk import Client
|
|
1261
1154
|
>>> client = Client("http://localhost.com", "masterKey") as client:
|
|
1262
1155
|
>>> indexes = client.get_indexes()
|
|
@@ -1283,20 +1176,16 @@ class Client(BaseClient):
|
|
|
1283
1176
|
"""Gets a single index based on the uid of the index.
|
|
1284
1177
|
|
|
1285
1178
|
Args:
|
|
1286
|
-
|
|
1287
1179
|
uid: The index's unique identifier.
|
|
1288
1180
|
|
|
1289
1181
|
Returns:
|
|
1290
|
-
|
|
1291
1182
|
An Index instance containing the information of the fetched index.
|
|
1292
1183
|
|
|
1293
1184
|
Raises:
|
|
1294
|
-
|
|
1295
1185
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1296
1186
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1297
1187
|
|
|
1298
|
-
Examples
|
|
1299
|
-
|
|
1188
|
+
Examples
|
|
1300
1189
|
>>> from meilisearch_python_sdk import Client
|
|
1301
1190
|
>>> client = Client("http://localhost.com", "masterKey")
|
|
1302
1191
|
>>> index = client.get_index()
|
|
@@ -1307,21 +1196,17 @@ class Client(BaseClient):
|
|
|
1307
1196
|
"""Create a local reference to an index identified by UID, without making an HTTP call.
|
|
1308
1197
|
|
|
1309
1198
|
Args:
|
|
1310
|
-
|
|
1311
1199
|
uid: The index's unique identifier.
|
|
1312
1200
|
plugins: Optional plugins can be provided to extend functionality.
|
|
1313
1201
|
|
|
1314
1202
|
Returns:
|
|
1315
|
-
|
|
1316
1203
|
An Index instance.
|
|
1317
1204
|
|
|
1318
1205
|
Raises:
|
|
1319
|
-
|
|
1320
1206
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1321
1207
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1322
1208
|
|
|
1323
|
-
Examples
|
|
1324
|
-
|
|
1209
|
+
Examples
|
|
1325
1210
|
>>> from meilisearch_python_sdk import Client
|
|
1326
1211
|
>>> client = Client("http://localhost.com", "masterKey")
|
|
1327
1212
|
>>> index = client.index("movies")
|
|
@@ -1332,17 +1217,14 @@ class Client(BaseClient):
|
|
|
1332
1217
|
"""Get stats for all indexes.
|
|
1333
1218
|
|
|
1334
1219
|
Returns:
|
|
1335
|
-
|
|
1336
1220
|
Information about database size and all indexes.
|
|
1337
1221
|
https://docs.meilisearch.com/reference/api/stats.html
|
|
1338
1222
|
|
|
1339
1223
|
Raises:
|
|
1340
|
-
|
|
1341
1224
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1342
1225
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1343
1226
|
|
|
1344
|
-
Examples
|
|
1345
|
-
|
|
1227
|
+
Examples
|
|
1346
1228
|
>>> from meilisearch_python_sdk import Client
|
|
1347
1229
|
>>> client = Client("http://localhost.com", "masterKey")
|
|
1348
1230
|
>>> stats = client.get_all_stats()
|
|
@@ -1362,7 +1244,6 @@ class Client(BaseClient):
|
|
|
1362
1244
|
"""Get an index, or create it if it doesn't exist.
|
|
1363
1245
|
|
|
1364
1246
|
Args:
|
|
1365
|
-
|
|
1366
1247
|
uid: The index's unique identifier.
|
|
1367
1248
|
primary_key: The primary key of the documents. Defaults to None.
|
|
1368
1249
|
plugins: Optional plugins can be provided to extend functionality.
|
|
@@ -1370,17 +1251,14 @@ class Client(BaseClient):
|
|
|
1370
1251
|
JsonDict
|
|
1371
1252
|
|
|
1372
1253
|
Returns:
|
|
1373
|
-
|
|
1374
1254
|
An instance of Index containing the information of the retrieved or newly created index.
|
|
1375
1255
|
|
|
1376
1256
|
Raises:
|
|
1377
|
-
|
|
1378
1257
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1379
1258
|
MeilisearchApiError: If the Meilisearch API returned an error.MeilisearchTimeoutError: If the connection times out.
|
|
1380
1259
|
MeilisearchTimeoutError: If the connection times out.
|
|
1381
1260
|
|
|
1382
|
-
Examples
|
|
1383
|
-
|
|
1261
|
+
Examples
|
|
1384
1262
|
>>> from meilisearch_python_sdk import Client
|
|
1385
1263
|
>>> client = Client("http://localhost.com", "masterKey")
|
|
1386
1264
|
>>> index = client.get_or_create_index("movies")
|
|
@@ -1399,21 +1277,17 @@ class Client(BaseClient):
|
|
|
1399
1277
|
"""Creates a new API key.
|
|
1400
1278
|
|
|
1401
1279
|
Args:
|
|
1402
|
-
|
|
1403
1280
|
key: The information to use in creating the key. Note that if an expires_at value
|
|
1404
1281
|
is included it should be in UTC time.
|
|
1405
1282
|
|
|
1406
1283
|
Returns:
|
|
1407
|
-
|
|
1408
1284
|
The new API key.
|
|
1409
1285
|
|
|
1410
1286
|
Raises:
|
|
1411
|
-
|
|
1412
1287
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1413
1288
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1414
1289
|
|
|
1415
|
-
Examples
|
|
1416
|
-
|
|
1290
|
+
Examples
|
|
1417
1291
|
>>> from meilisearch_python_sdk import Client
|
|
1418
1292
|
>>> from meilissearch_async_client.models.client import KeyCreate
|
|
1419
1293
|
>>> client = Client("http://localhost.com", "masterKey")
|
|
@@ -1434,20 +1308,16 @@ class Client(BaseClient):
|
|
|
1434
1308
|
"""Deletes an API key.
|
|
1435
1309
|
|
|
1436
1310
|
Args:
|
|
1437
|
-
|
|
1438
1311
|
key: The key or uid to delete.
|
|
1439
1312
|
|
|
1440
1313
|
Returns:
|
|
1441
|
-
|
|
1442
1314
|
The Response status code. 204 signifies a successful delete.
|
|
1443
1315
|
|
|
1444
1316
|
Raises:
|
|
1445
|
-
|
|
1446
1317
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1447
1318
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1448
1319
|
|
|
1449
|
-
Examples
|
|
1450
|
-
|
|
1320
|
+
Examples
|
|
1451
1321
|
>>> from meilisearch_python_sdk import Client
|
|
1452
1322
|
>>> client = Client("http://localhost.com", "masterKey")
|
|
1453
1323
|
>>> client.delete_key("abc123")
|
|
@@ -1458,23 +1328,19 @@ class Client(BaseClient):
|
|
|
1458
1328
|
def get_keys(self, *, offset: int | None = None, limit: int | None = None) -> KeySearch:
|
|
1459
1329
|
"""Gets the Meilisearch API keys.
|
|
1460
1330
|
Args:
|
|
1461
|
-
|
|
1462
1331
|
offset: Number of indexes to skip. The default of None will use the Meilisearch
|
|
1463
1332
|
default.
|
|
1464
1333
|
limit: Number of indexes to return. The default of None will use the Meilisearch
|
|
1465
1334
|
default.
|
|
1466
1335
|
|
|
1467
1336
|
Returns:
|
|
1468
|
-
|
|
1469
1337
|
API keys.
|
|
1470
1338
|
|
|
1471
1339
|
Raises:
|
|
1472
|
-
|
|
1473
1340
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1474
1341
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1475
1342
|
|
|
1476
|
-
Examples
|
|
1477
|
-
|
|
1343
|
+
Examples
|
|
1478
1344
|
>>> from meilisearch_python_sdk import Client
|
|
1479
1345
|
>>> client = AsyncClient("http://localhost.com", "masterKey")
|
|
1480
1346
|
>>> keys = client.get_keys()
|
|
@@ -1488,20 +1354,16 @@ class Client(BaseClient):
|
|
|
1488
1354
|
"""Gets information about a specific API key.
|
|
1489
1355
|
|
|
1490
1356
|
Args:
|
|
1491
|
-
|
|
1492
1357
|
key: The key for which to retrieve the information.
|
|
1493
1358
|
|
|
1494
1359
|
Returns:
|
|
1495
|
-
|
|
1496
1360
|
The API key, or `None` if the key is not found.
|
|
1497
1361
|
|
|
1498
1362
|
Raises:
|
|
1499
|
-
|
|
1500
1363
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1501
1364
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1502
1365
|
|
|
1503
|
-
Examples
|
|
1504
|
-
|
|
1366
|
+
Examples
|
|
1505
1367
|
>>> from meilisearch_python_sdk import Client
|
|
1506
1368
|
>>> client = Client("http://localhost.com", "masterKey")
|
|
1507
1369
|
>>> keys = client.get_key("abc123")
|
|
@@ -1514,21 +1376,17 @@ class Client(BaseClient):
|
|
|
1514
1376
|
"""Update an API key.
|
|
1515
1377
|
|
|
1516
1378
|
Args:
|
|
1517
|
-
|
|
1518
1379
|
key: The information to use in updating the key. Note that if an expires_at value
|
|
1519
1380
|
is included it should be in UTC time.
|
|
1520
1381
|
|
|
1521
1382
|
Returns:
|
|
1522
|
-
|
|
1523
1383
|
The updated API key.
|
|
1524
1384
|
|
|
1525
1385
|
Raises:
|
|
1526
|
-
|
|
1527
1386
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1528
1387
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1529
1388
|
|
|
1530
|
-
Examples
|
|
1531
|
-
|
|
1389
|
+
Examples
|
|
1532
1390
|
>>> from meilisearch_python_sdk import Client
|
|
1533
1391
|
>>> from meilissearch_async_client.models.client import KeyUpdate
|
|
1534
1392
|
>>> client = Client("http://localhost.com", "masterKey")
|
|
@@ -1547,13 +1405,12 @@ class Client(BaseClient):
|
|
|
1547
1405
|
self,
|
|
1548
1406
|
queries: list[SearchParams],
|
|
1549
1407
|
*,
|
|
1550
|
-
federation: Federation | None = None,
|
|
1408
|
+
federation: Federation | FederationMerged | None = None,
|
|
1551
1409
|
hits_type: Any = JsonDict,
|
|
1552
1410
|
) -> list[SearchResultsWithUID] | SearchResultsFederated:
|
|
1553
1411
|
"""Multi-index search.
|
|
1554
1412
|
|
|
1555
1413
|
Args:
|
|
1556
|
-
|
|
1557
1414
|
queries: List of SearchParameters
|
|
1558
1415
|
federation: If included a single search result with hits built from all queries will
|
|
1559
1416
|
be returned. This parameter can only be used with Meilisearch >= v1.10.0. Defaults
|
|
@@ -1562,16 +1419,13 @@ class Client(BaseClient):
|
|
|
1562
1419
|
JsonDict
|
|
1563
1420
|
|
|
1564
1421
|
Returns:
|
|
1565
|
-
|
|
1566
1422
|
Results of the search
|
|
1567
1423
|
|
|
1568
1424
|
Raises:
|
|
1569
|
-
|
|
1570
1425
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1571
1426
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1572
1427
|
|
|
1573
|
-
Examples
|
|
1574
|
-
|
|
1428
|
+
Examples
|
|
1575
1429
|
>>> from meilisearch_python_sdk import Client
|
|
1576
1430
|
>>> from meilisearch_python_sdk.models.search import SearchParams
|
|
1577
1431
|
>>> client = Client("http://localhost.com", "masterKey")
|
|
@@ -1592,10 +1446,18 @@ class Client(BaseClient):
|
|
|
1592
1446
|
else:
|
|
1593
1447
|
processed_queries = [x.model_dump(by_alias=True) for x in queries]
|
|
1594
1448
|
|
|
1449
|
+
if federation:
|
|
1450
|
+
federation_payload = federation.model_dump(by_alias=True)
|
|
1451
|
+
if federation.facets_by_index is None:
|
|
1452
|
+
del federation_payload["facetsByIndex"]
|
|
1453
|
+
|
|
1454
|
+
else:
|
|
1455
|
+
federation_payload = None
|
|
1456
|
+
|
|
1595
1457
|
response = self._http_requests.post(
|
|
1596
1458
|
url,
|
|
1597
1459
|
body={
|
|
1598
|
-
"federation":
|
|
1460
|
+
"federation": federation_payload,
|
|
1599
1461
|
"queries": processed_queries,
|
|
1600
1462
|
},
|
|
1601
1463
|
)
|
|
@@ -1610,20 +1472,16 @@ class Client(BaseClient):
|
|
|
1610
1472
|
"""Gets the index and returns all the index information rather than an Index instance.
|
|
1611
1473
|
|
|
1612
1474
|
Args:
|
|
1613
|
-
|
|
1614
1475
|
uid: The index's unique identifier.
|
|
1615
1476
|
|
|
1616
1477
|
Returns:
|
|
1617
|
-
|
|
1618
1478
|
Index information rather than an Index instance.
|
|
1619
1479
|
|
|
1620
1480
|
Raises:
|
|
1621
|
-
|
|
1622
1481
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1623
1482
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1624
1483
|
|
|
1625
|
-
Examples
|
|
1626
|
-
|
|
1484
|
+
Examples
|
|
1627
1485
|
>>> from meilisearch_python_sdk import Client
|
|
1628
1486
|
>>> client = Client("http://localhost.com", "masterKey")
|
|
1629
1487
|
>>> index = client.get_raw_index("movies")
|
|
@@ -1640,7 +1498,6 @@ class Client(BaseClient):
|
|
|
1640
1498
|
) -> list[IndexInfo] | None:
|
|
1641
1499
|
"""Gets all the indexes.
|
|
1642
1500
|
Args:
|
|
1643
|
-
|
|
1644
1501
|
offset: Number of indexes to skip. The default of None will use the Meilisearch
|
|
1645
1502
|
default.
|
|
1646
1503
|
limit: Number of indexes to return. The default of None will use the Meilisearch
|
|
@@ -1649,16 +1506,13 @@ class Client(BaseClient):
|
|
|
1649
1506
|
Returns all the index information rather than an AsyncIndex instance.
|
|
1650
1507
|
|
|
1651
1508
|
Returns:
|
|
1652
|
-
|
|
1653
1509
|
A list of the Index information rather than an AsyncIndex instances.
|
|
1654
1510
|
|
|
1655
1511
|
Raises:
|
|
1656
|
-
|
|
1657
1512
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1658
1513
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1659
1514
|
|
|
1660
|
-
Examples
|
|
1661
|
-
|
|
1515
|
+
Examples
|
|
1662
1516
|
>>> from meilisearch_python_sdk import Client
|
|
1663
1517
|
>>> client = Client("http://localhost.com", "masterKey")
|
|
1664
1518
|
>>> index = client.get_raw_indexes()
|
|
@@ -1675,16 +1529,13 @@ class Client(BaseClient):
|
|
|
1675
1529
|
"""Get the Meilisearch version.
|
|
1676
1530
|
|
|
1677
1531
|
Returns:
|
|
1678
|
-
|
|
1679
1532
|
Information about the version of Meilisearch.
|
|
1680
1533
|
|
|
1681
1534
|
Raises:
|
|
1682
|
-
|
|
1683
1535
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1684
1536
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1685
1537
|
|
|
1686
|
-
Examples
|
|
1687
|
-
|
|
1538
|
+
Examples
|
|
1688
1539
|
>>> from meilisearch_python_sdk import Client
|
|
1689
1540
|
>>> client = Client("http://localhost.com", "masterKey")
|
|
1690
1541
|
>>> version = client.get_version()
|
|
@@ -1697,16 +1548,13 @@ class Client(BaseClient):
|
|
|
1697
1548
|
"""Get health of the Meilisearch server.
|
|
1698
1549
|
|
|
1699
1550
|
Returns:
|
|
1700
|
-
|
|
1701
1551
|
The status of the Meilisearch server.
|
|
1702
1552
|
|
|
1703
1553
|
Raises:
|
|
1704
|
-
|
|
1705
1554
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1706
1555
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1707
1556
|
|
|
1708
|
-
Examples
|
|
1709
|
-
|
|
1557
|
+
Examples
|
|
1710
1558
|
>>> from meilisearch_python_sdk import Client
|
|
1711
1559
|
>>> client = Client("http://localhost.com", "masterKey")
|
|
1712
1560
|
>>> health = client.get_health()
|
|
@@ -1719,20 +1567,16 @@ class Client(BaseClient):
|
|
|
1719
1567
|
"""Swap two indexes.
|
|
1720
1568
|
|
|
1721
1569
|
Args:
|
|
1722
|
-
|
|
1723
1570
|
indexes: A list of tuples, each tuple should contain the indexes to swap.
|
|
1724
1571
|
|
|
1725
1572
|
Returns:
|
|
1726
|
-
|
|
1727
1573
|
The details of the task.
|
|
1728
1574
|
|
|
1729
1575
|
Raises:
|
|
1730
|
-
|
|
1731
1576
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1732
1577
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1733
1578
|
|
|
1734
|
-
Examples
|
|
1735
|
-
|
|
1579
|
+
Examples
|
|
1736
1580
|
>>> from meilisearch_python_sdk import Client
|
|
1737
1581
|
>>> client = Client("http://localhost.com", "masterKey")
|
|
1738
1582
|
>>> index = client.swap_indexes([("index_a", "index_b")])
|
|
@@ -1759,7 +1603,6 @@ class Client(BaseClient):
|
|
|
1759
1603
|
Defaults to cancelling all tasks.
|
|
1760
1604
|
|
|
1761
1605
|
Args:
|
|
1762
|
-
|
|
1763
1606
|
uids: A list of task UIDs to cancel.
|
|
1764
1607
|
index_uids: A list of index UIDs for which to cancel tasks.
|
|
1765
1608
|
statuses: A list of statuses to cancel.
|
|
@@ -1770,17 +1613,14 @@ class Client(BaseClient):
|
|
|
1770
1613
|
after_finished_at: Cancel tasks that were finished after the specified date time.
|
|
1771
1614
|
|
|
1772
1615
|
Returns:
|
|
1773
|
-
|
|
1774
1616
|
The details of the task
|
|
1775
1617
|
|
|
1776
1618
|
Raises:
|
|
1777
|
-
|
|
1778
1619
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1779
1620
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1780
1621
|
MeilisearchTimeoutError: If the connection times out.
|
|
1781
1622
|
|
|
1782
|
-
Examples
|
|
1783
|
-
|
|
1623
|
+
Examples
|
|
1784
1624
|
>>> from meilisearch_python_sdk import Client
|
|
1785
1625
|
>>> from meilisearch_python_sdk.task import cancel_tasks
|
|
1786
1626
|
>>>
|
|
@@ -1816,7 +1656,6 @@ class Client(BaseClient):
|
|
|
1816
1656
|
Defaults to deleting all tasks.
|
|
1817
1657
|
|
|
1818
1658
|
Args:
|
|
1819
|
-
|
|
1820
1659
|
uids: A list of task UIDs to delete.
|
|
1821
1660
|
index_uids: A list of index UIDs for which to delete tasks.
|
|
1822
1661
|
statuses: A list of statuses to delete.
|
|
@@ -1827,17 +1666,14 @@ class Client(BaseClient):
|
|
|
1827
1666
|
after_finished_at: Delete tasks that were finished after the specified date time.
|
|
1828
1667
|
|
|
1829
1668
|
Returns:
|
|
1830
|
-
|
|
1831
1669
|
The details of the task
|
|
1832
1670
|
|
|
1833
1671
|
Raises:
|
|
1834
|
-
|
|
1835
1672
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1836
1673
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1837
1674
|
MeilisearchTimeoutError: If the connection times out.
|
|
1838
1675
|
|
|
1839
|
-
Examples
|
|
1840
|
-
|
|
1676
|
+
Examples
|
|
1841
1677
|
>>> from meilisearch_python_sdk import Client
|
|
1842
1678
|
>>>
|
|
1843
1679
|
>>> client = Client("http://localhost.com", "masterKey")
|
|
@@ -1859,21 +1695,17 @@ class Client(BaseClient):
|
|
|
1859
1695
|
"""Get a single task from it's task id.
|
|
1860
1696
|
|
|
1861
1697
|
Args:
|
|
1862
|
-
|
|
1863
1698
|
task_id: Identifier of the task to retrieve.
|
|
1864
1699
|
|
|
1865
1700
|
Returns:
|
|
1866
|
-
|
|
1867
1701
|
Results of a task.
|
|
1868
1702
|
|
|
1869
1703
|
Raises:
|
|
1870
|
-
|
|
1871
1704
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1872
1705
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1873
1706
|
MeilisearchTimeoutError: If the connection times out.
|
|
1874
1707
|
|
|
1875
|
-
Examples
|
|
1876
|
-
|
|
1708
|
+
Examples
|
|
1877
1709
|
>>> from meilisearch_python_sdk import Client
|
|
1878
1710
|
>>>
|
|
1879
1711
|
>>> client = AsyncClient("http://localhost.com", "masterKey")
|
|
@@ -1890,23 +1722,19 @@ class Client(BaseClient):
|
|
|
1890
1722
|
"""Get multiple tasks.
|
|
1891
1723
|
|
|
1892
1724
|
Args:
|
|
1893
|
-
|
|
1894
1725
|
index_ids: A list of index UIDs for which to get the tasks. If provided this will get the
|
|
1895
1726
|
tasks only for the specified indexes, if not all tasks will be returned. Default = None
|
|
1896
1727
|
types: Specify specific task types to retrieve. Default = None
|
|
1897
1728
|
|
|
1898
1729
|
Returns:
|
|
1899
|
-
|
|
1900
1730
|
Task statuses.
|
|
1901
1731
|
|
|
1902
1732
|
Raises:
|
|
1903
|
-
|
|
1904
1733
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1905
1734
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1906
1735
|
MeilisearchTimeoutError: If the connection times out.
|
|
1907
1736
|
|
|
1908
|
-
Examples
|
|
1909
|
-
|
|
1737
|
+
Examples
|
|
1910
1738
|
>>> from meilisearch_python_sdk import Client
|
|
1911
1739
|
>>>
|
|
1912
1740
|
>>> client = Client("http://localhost.com", "masterKey")
|
|
@@ -1925,8 +1753,6 @@ class Client(BaseClient):
|
|
|
1925
1753
|
"""Wait until Meilisearch processes a task, and get its status.
|
|
1926
1754
|
|
|
1927
1755
|
Args:
|
|
1928
|
-
|
|
1929
|
-
client: An httpx HttpxClient or meilisearch_python_sdk Client instance.
|
|
1930
1756
|
task_id: Identifier of the task to retrieve.
|
|
1931
1757
|
timeout_in_ms: Amount of time in milliseconds to wait before raising a
|
|
1932
1758
|
MeilisearchTimeoutError. `None` can also be passed to wait indefinitely. Be aware that
|
|
@@ -1936,18 +1762,15 @@ class Client(BaseClient):
|
|
|
1936
1762
|
has a failed status. Defaults to False.
|
|
1937
1763
|
|
|
1938
1764
|
Returns:
|
|
1939
|
-
|
|
1940
1765
|
Details of the processed update status.
|
|
1941
1766
|
|
|
1942
1767
|
Raises:
|
|
1943
|
-
|
|
1944
1768
|
MeilisearchCommunicationError: If there was an error communicating with the server.
|
|
1945
1769
|
MeilisearchApiError: If the Meilisearch API returned an error.
|
|
1946
1770
|
MeilisearchTimeoutError: If the connection times out.
|
|
1947
1771
|
MeilisearchTaskFailedError: If `raise_for_status` is `True` and a task has a failed status.
|
|
1948
1772
|
|
|
1949
|
-
Examples
|
|
1950
|
-
|
|
1773
|
+
Examples
|
|
1951
1774
|
>>> from meilisearch_python_sdk import Client
|
|
1952
1775
|
>>> >>> documents = [
|
|
1953
1776
|
>>> {"id": 1, "title": "Movie 1", "genre": "comedy"},
|