API Key Error and Sorting Issue in Java Client

TLDR suraj faced an API key error and sorting issue in their Java code. Kishore Nallan provided guidance, and after rechecking the fields, suraj confirmed that all issues were resolved.

Photo of suraj
suraj
Sat, 25 Mar 2023 05:54:57 UTC

can anybody help me on this?

Photo of Kishore Nallan
Kishore Nallan
Sat, 25 Mar 2023 06:23:00 UTC

Can you please post the full gist along with client initialisation? Typically this error means a bad API key is used. Check if key has write permissions.

Photo of suraj
suraj
Sat, 25 Mar 2023 07:01:15 UTC

docker run -p 8108:8108 -v/tmp/data:/data typesense/typesense:0.24.0 --data-dir /data --api-key=*Hu52dwsas2AdxdE*

Photo of suraj
suraj
Sat, 25 Mar 2023 07:01:31 UTC

Have used this in my windows machine

Photo of suraj
suraj
Sat, 25 Mar 2023 07:01:59 UTC

while create=ing client I am passing abive api-key

Photo of Kishore Nallan
Kishore Nallan
Sat, 25 Mar 2023 07:02:56 UTC

I mean the full Java code

Photo of suraj
suraj
Sat, 25 Mar 2023 07:04:52 UTC

Photo of suraj
suraj
Sat, 25 Mar 2023 07:06:31 UTC

Photo of Kishore Nallan
Kishore Nallan
Sat, 25 Mar 2023 07:07:28 UTC

Hmm that looks fine. None of the other endpoints like health works also?

Photo of suraj
suraj
Sat, 25 Mar 2023 07:23:54 UTC

for health - { "ok": *true* }

Photo of suraj
suraj
Sat, 25 Mar 2023 07:24:02 UTC

getting response

Photo of Kishore Nallan
Kishore Nallan
Sat, 25 Mar 2023 07:25:47 UTC

Can you tell me the version of Java client used? I'm afk at the moment, will get back to you later after checking.

Photo of suraj
suraj
Sat, 25 Mar 2023 13:00:56 UTC

API issue is solved however while testing I found out that somehow sorting is not working..Am i using it wrong?

Photo of suraj
suraj
Sat, 25 Mar 2023 13:01:47 UTC

Photo of suraj
suraj
Sat, 25 Mar 2023 13:01:58 UTC

Have added code and response

Photo of Kishore Nallan
Kishore Nallan
Sun, 26 Mar 2023 13:50:29 UTC

> API issue is solved What was the issue? > somehow sorting is not working Can you elaborate what you are expecting vs what you are getting? You're sorting by `ratings_count:desc` and I see that the responses are indeed in descending order of the value of the ratings_count field.

Photo of suraj
suraj
Sun, 02 Apr 2023 06:48:00 UTC

Thanks Kishor, I was checking the wrong field. All issues are sesolved