View Source ElasticsearchEx.Api.Document.Source (Elasticsearch_ex v1.7.0)

Provides the APIs for document source operations.

Summary

Functions

Checks if the specified JSON document from an index exists.

Retrieves the specified JSON document from an index.

Types

Functions

Link to this function

exists?(index, document_id, opts \\ [])

View Source (since 1.0.0)
@spec exists?(index(), document_id(), keyword()) :: boolean()

Checks if the specified JSON document from an index exists.

Query parameters

Refer to the official documentation for a detailed list of the parameters.

Examples

iex> ElasticsearchEx.Api.Document.Source.exists?("0", "my-index-000001")
true
Link to this function

get(index, document_id, opts \\ [])

View Source (since 1.0.0)

Retrieves the specified JSON document from an index.

Query parameters

Refer to the official documentation for a detailed list of the parameters.

Examples

iex> ElasticsearchEx.Api.Document.Source.get("0", "my-index-000001")
{:ok,
 %{
   "@timestamp" => "2099-11-15T14:12:12",
   "http" => %{
     "request" => %{"method" => "get"},
     "response" => %{"bytes" => 1_070_000, "status_code" => 200},
     "version" => "1.1"
   },
   "message" => "GET /search HTTP/1.1 200 1070000",
   "source" => %{"ip" => "127.0.0.1"},
   "user" => %{"id" => "kimchy"}
 }}