Write some code that is causing me problems, Types...
# community-help
j
Write some code that is causing me problems, Typesense 0.22.2 I have raised a ticket #568 but main issue is I don’t know which records are supposed to be the “problem” E20220405 184930.707577 15581 collection.cpp:77] JSON error: [json.exception.parse_error.101] parse error at line 1, column 8: syntax error while parsing value - unexpected ‘:’; expected end of input The errors all say line 1
j
Could you share just the first line of your JSONL file?
head -1 allrec2.tmp
j
{ “published”: “2021-12-08T192653-05:00", “updated”: “2021-12-08T192653-05:00", “title”: “La Florentine Panettone”, “vendor”: “La Florentine”, “id”: “bc7bf87d3ee7de79f767dc0c6b1f4f827eb304ce”, “price”: “10.00", “currency”: “USD”, “link”: “https://torronecandy.com/products/la-florentine-panettone”, “tag”: “BrandLa Florentine Holiday Specialties new items Panettone TypePanettone “, “image”: “https://cdn.shopify.com/s/files/1/0234/7301/products/La-Florentine-panettone-17-6.jpg?v=1639009499”, “summary”: “Vendor La Florentine Type Cakes Dessert Bars Price 1000 La Florentine Panettone is packed in Italy and made with an original recipe t hat yields a light yellow center adorned with candied fruits Product of Italy 176 oz Best if heated before serving” }, { “published”: “2021-12-03T170709-05:00", “updated”: “2021-12-03T170709-05:00", “title”: “Italy Lanyard”,
j
The entire record should be in a single line...
What does
head -1 allrec2.tmp
return?
j
Oh, ok
I can do that wont take me long jsonl (line) eek
👍 1
Presume no comma separator?
j
Correct
😗 1
j
Thanks loading now :)
👍 1
Getting
W20220405 193941.395893 16410 default_variables.cpp:335] Fail to open /proc/self/fd: Too many open files [24]
j
👍 1
j
just doing that already thank
👍 1
ulimit -n 8192
Ah need to convert my dates to int64 (on it)
Mmm file didnt import
Traceback (most recent call last): File “type.py”, line 23, in <module> client.collections[‘hoybuyer’].documents.import_(jsonl_file.read().encode(‘utf-8’), {‘batch_size’: 50000}) File “/home/ubuntu/.local/lib/python3.8/site-packages/typesense/documents.py”, line 71, in import_ api_response = self.api_call.post(self._endpoint_path(‘import’), documents, params, as_json=False) File “/home/ubuntu/.local/lib/python3.8/site-packages/typesense/api_call.py”, line 143, in post return self.make_request(requests.post, endpoint, as_json, File “/home/ubuntu/.local/lib/python3.8/site-packages/typesense/api_call.py”, line 115, in make_request raise ApiCall.get_exception(r.status_code)(r.status_code, error_message) typesense.exceptions.ObjectNotFound: [Errno 404] Not Found
j
Did you create the collection first?
j
schema = { “name”: “hotbuyer”, “fields”: [ {“name”: “.*“, “type”: “auto” } ] }
Maybe pre define layout?
j
This should work... Could you share the full code snippet you're using?
j
I think I need to increase the timeout I got on the server
E20220405 194623.849108 16947 raft_server.cpp:601] 4153 queued writes > healthy read lag of 1000 E20220405 194623.849153 16947 raft_server.cpp:613] 4153 queued writes > healthy write lag of 500
client = typesense.Client({ ‘nodes’: [{ ‘host’: ‘localhost’, # For Typesense Cloud use xxx.a1.typesense.net ‘port’: ‘8108’, # For Typesense Cloud use 443 ‘protocol’: ‘http’ # For Typesense Cloud use https }], ‘api_key’: ‘abc’, ‘connection_timeout_seconds’: 3000 }) schema = { “name”: “hotbuyer”, “fields”: [ {“name”: “.*“, “type”: “auto” } ] } client.collections.create(schema) with open(‘allrec2.jsonl’) as jsonl_file: client.collections[‘hoybuyer’].documents.import_(jsonl_file.read().encode(‘utf-8’), {‘batch_size’: 50000})
j
There's a typo in
hoybuyer
in the import call
👍 1
j
Ah thanks
👍 1
I presume I have to convert my dates into int64 in code (i.e python) and there is no feature to do this for me?
j
Yup, that's correct
👍 1