Skip to content

Commit d7441f5

Browse files
vovayartsevMikaAK
authored andcommitted
Fix query
1 parent 1824003 commit d7441f5

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/pinecone.ex

+7-1
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,12 @@ defmodule Pinecone do
376376
end
377377
end
378378

379+
defp post_root(path, name, body, opts) do
380+
with {:ok, host} <- index_host(name) do
381+
HTTP.post({:root, host}, path, body, opts)
382+
end
383+
end
384+
379385
defp index_host(index_name) do
380386
with {:ok, %{"host" => host}} <- describe_index(index_name) do
381387
{:ok, host}
@@ -434,7 +440,7 @@ defmodule Pinecone do
434440

435441
body = if opts[:namespace], do: Map.put(body, "namespace", opts[:namespace]), else: body
436442

437-
post_vector("query", name, body, opts[:config])
443+
post_root("query", name, body, opts[:config])
438444
end
439445

440446
## Collection Operations

lib/pinecone/http.ex

+4
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ defmodule Pinecone.HTTP do
7070
Path.join("https://#{host}/vectors", endpoint)
7171
end
7272

73+
defp url({:root, host}, endpoint, _env) do
74+
Path.join("https://#{host}", endpoint)
75+
end
76+
7377
defp headers(api_key) do
7478
api_key =
7579
if api_key do

0 commit comments

Comments
 (0)