View Source ElasticsearchEx.API.Document.Source (Elasticsearch_ex v1.8.3)

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

document_id()

@type document_id() :: ElasticsearchEx.document_id()

index()

@type index() :: ElasticsearchEx.index()

opts()

@type opts() :: ElasticsearchEx.opts()

Functions

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

(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

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

(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"}
 }}