knox ha revisionato questo gist . Vai alla revisione
1 file changed, 21 insertions
Typesense-readme-3.py(file creato)
@@ -0,0 +1,21 @@ | |||
1 | + | import typesense | |
2 | + | ||
3 | + | client = typesense.Client({ | |
4 | + | 'api_key': 'Hu52dwsas2AdxdE', | |
5 | + | 'nodes': [{ | |
6 | + | 'host': 'localhost', | |
7 | + | 'port': '8108', | |
8 | + | 'protocol': 'http' | |
9 | + | }], | |
10 | + | 'connection_timeout_seconds': 2 | |
11 | + | }) | |
12 | + | ||
13 | + | create_response = client.collections.create({ | |
14 | + | "name": "companies", | |
15 | + | "fields": [ | |
16 | + | {"name": "company_name", "type": "string" }, | |
17 | + | {"name": "num_employees", "type": "int32" }, | |
18 | + | {"name": "country", "type": "string", "facet": True } | |
19 | + | ], | |
20 | + | "default_sorting_field": "num_employees" | |
21 | + | }) |
Più nuovi
Più vecchi