-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
I tried without success to use snap from a Livebook. (also referenced in #94 ).
I installed finch (instead of Req) and run an OpenSearch image:
docker pull opensearchproject/opensearch:latest
docker pull opensearchproject/opensearch-dashboards:latest
docker run -d --name opensearch \
-p 9200:9200 -p 9600:9600 \
-e "discovery.type=single-node" \
-e "OPENSEARCH_INITIAL_ADMIN_PASSWORD=a K 12 3 45 6 78 9?" \
-e "cluster.name=my-cluster" \
-e "node.name=node1" \
-v open-search:/usr/share/opensearch/data \
opensearchproject/opensearch:latestThe Livebook:
Mix.install([{:snap, "~> 0.11"}, {:finch, "~> 0.19"}])
defmodule MyApp.Cluster do
use Snap.Cluster, opt_app: :noop
end
Finch.start_link(name: MyFinch)
{:ok, _} = Kino.start_child(
{MyApp.Cluster, [
url: "http://localhost:9200",
username: "admin",
password: "a K 12 3 45 6 78 9#"
]
}
)I create an index and define a map with two fields "title" and "chunk_text" of type "text":
map = %{
"mappings" => %{
"properties" => %{
"title" => %{"type" => "text"},
"chunk_text" => %{
"type" => "text",
"fields" => %{
"raw" => %{"type" => "keyword"}
}
}
}
}
}
Snap.Indexes.create(MyApp.Cluster, "my-index", map)I get in the Livebook:
{:error, %Snap.HTTPClient.Error{reason: :closed, origin: %Mint.TransportError{reason: :closed}}}and in the terminal (running livebook server)
[debug] Elasticsearch GET request path=/my-index/_doc status= response=12ms decode=0ms total=12msBesides the connection failure, the create index documentation indicates a PUT request whilst this generates GET request.
Metadata
Metadata
Assignees
Labels
No labels