Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if [ ! $CI ]; then

rm -rf vendor/;
mkdir vendor/;
mix elasticsearch.install vendor --version 6.8.1 || { echo "Elasticsearch could not be installed!"; exit 1; }
mix elasticsearch.install vendor --version 7.12.0 || { echo "Elasticsearch could not be installed!"; exit 1; }
fi

echo "----------------------------------------------------------"
Expand Down
5 changes: 3 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ services:
environment:
POSTGRES_HOST_AUTH_METHOD: "trust"
elasticsearch:
# image: docker.elastic.co/elasticsearch/elasticsearch:7.10.2
image: docker.elastic.co/elasticsearch/elasticsearch:6.8.13
image: docker.elastic.co/elasticsearch/elasticsearch:7.12.0
# image: docker.elastic.co/elasticsearch/elasticsearch:6.8.13
environment:
- node.name=es01
- bootstrap.memory_lock=true
- discovery.type=single-node
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
Expand Down
18 changes: 9 additions & 9 deletions lib/elasticsearch.ex
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,13 @@ defmodule Elasticsearch do
iex> Elasticsearch.get(Cluster, "/nonexistent")
{:error,
%Elasticsearch.Exception{col: nil, line: nil,
message: "no such index", query: nil,
message: "no such index [nonexistent]", query: nil,
raw: %{"error" => %{"index" => "nonexistent",
"index_uuid" => "_na_", "reason" => "no such index",
"index_uuid" => "_na_", "reason" => "no such index [nonexistent]",
"resource.id" => "nonexistent",
"resource.type" => "index_or_alias",
"root_cause" => [%{"index" => "nonexistent",
"index_uuid" => "_na_", "reason" => "no such index",
"index_uuid" => "_na_", "reason" => "no such index [nonexistent]",
"resource.id" => "nonexistent",
"resource.type" => "index_or_alias",
"type" => "index_not_found_exception"}],
Expand Down Expand Up @@ -263,7 +263,7 @@ defmodule Elasticsearch do
true

iex> Elasticsearch.get!(Cluster, "/nonexistent")
** (Elasticsearch.Exception) (index_not_found_exception) no such index
** (Elasticsearch.Exception) (index_not_found_exception) no such index [nonexistent]
"""
@spec get!(Cluster.t(), url) :: map | no_return
@spec get!(Cluster.t(), url, opts) :: map | no_return
Expand Down Expand Up @@ -374,7 +374,7 @@ defmodule Elasticsearch do

iex> query = %{"query" => %{"match_all" => %{}}}
...> Elasticsearch.post!(Cluster, "/nonexistent/_search", query)
** (Elasticsearch.Exception) (index_not_found_exception) no such index
** (Elasticsearch.Exception) (index_not_found_exception) no such index [nonexistent]
"""
@spec post!(Cluster.t(), url, data) :: map | no_return
@spec post!(Cluster.t(), url, data, opts) :: map | no_return
Expand All @@ -398,13 +398,13 @@ defmodule Elasticsearch do
iex> Elasticsearch.delete(Cluster, "/nonexistent")
{:error,
%Elasticsearch.Exception{col: nil, line: nil,
message: "no such index", query: nil,
message: "no such index [nonexistent]", query: nil,
raw: %{"error" => %{"index" => "nonexistent",
"index_uuid" => "_na_", "reason" => "no such index",
"index_uuid" => "_na_", "reason" => "no such index [nonexistent]",
"resource.id" => "nonexistent",
"resource.type" => "index_or_alias",
"root_cause" => [%{"index" => "nonexistent",
"index_uuid" => "_na_", "reason" => "no such index",
"index_uuid" => "_na_", "reason" => "no such index [nonexistent]",
"resource.id" => "nonexistent",
"resource.type" => "index_or_alias",
"type" => "index_not_found_exception"}],
Expand Down Expand Up @@ -433,7 +433,7 @@ defmodule Elasticsearch do
Raises an error if the resource is invalid.

iex> Elasticsearch.delete!(Cluster, "/nonexistent")
** (Elasticsearch.Exception) (index_not_found_exception) no such index
** (Elasticsearch.Exception) (index_not_found_exception) no such index [nonexistent]
"""
@spec delete!(Cluster.t(), url) :: map | no_return
@spec delete!(Cluster.t(), url, opts) :: map | no_return
Expand Down
2 changes: 1 addition & 1 deletion lib/elasticsearch/indexing/bulk.ex
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ defmodule Elasticsearch.Index.Bulk do
\"\"\"

iex> Bulk.encode!(Cluster, 123, "my-index")
** (Protocol.UndefinedError) protocol Elasticsearch.Document not implemented for 123 of type Integer
** (Protocol.UndefinedError) protocol Elasticsearch.Document not implemented for 123 of type Integer. This protocol is implemented for the following type(s): Comment, Post
"""
def encode!(cluster, struct, index, action \\ "create") do
config = Cluster.Config.get(cluster)
Expand Down
2 changes: 1 addition & 1 deletion lib/elasticsearch/indexing/index.ex
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ defmodule Elasticsearch.Index do
:ok

iex> Index.refresh!(Cluster, "nonexistent")
** (Elasticsearch.Exception) (index_not_found_exception) no such index
** (Elasticsearch.Exception) (index_not_found_exception) no such index [nonexistent]
"""
@spec refresh!(Cluster.t(), String.t()) :: :ok
def refresh!(cluster, name) do
Expand Down
1 change: 1 addition & 0 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"poolboy": {:hex, :poolboy, "1.5.1", "6b46163901cfd0a1b43d692657ed9d7e599853b3b21b95ae5ae0a777cf9b6ca8", [:rebar], [], "hexpm", "8f7168911120e13419e086e78d20e4d1a6776f1eee2411ac9f790af10813389f"},
"postgrex": {:hex, :postgrex, "0.15.7", "724410acd48abac529d0faa6c2a379fb8ae2088e31247687b16cacc0e0883372", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "88310c010ff047cecd73d5ceca1d99205e4b1ab1b9abfdab7e00f5c9d20ef8f9"},
"sigaws": {:hex, :sigaws, "0.7.2", "2b0bcd3979f2ae19337d0a6e52b4b1f37ac3d778201019240e641471a2d36685", [:mix], [], "hexpm", "5d3f3c9a259b052015297b3392800b95a7672c7cf3e878cf88c0d33213ac2e55"},
"sigaws_otp_24": {:hex, :sigaws_otp_24, "1.0.0", "cd8e41a6c198ba8c9005d2ec8cf427196100d7f0d6089b68afa501df3e035049", [:mix], [], "hexpm", "624550f60c651be6680fa200afc11e01fa8c10df16e3b6dfe2c8b0f2a54abddd"},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"},
"telemetry": {:hex, :telemetry, "0.4.3", "a06428a514bdbc63293cd9a6263aad00ddeb66f608163bdec7c8995784080818", [:rebar3], [], "hexpm", "eb72b8365ffda5bed68a620d1da88525e326cb82a75ee61354fc24b844768041"},
"unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"},
Expand Down
8 changes: 4 additions & 4 deletions test/mix/elasticsearch.build_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ defmodule Mix.Tasks.Elasticsearch.BuildTest do
Index created, but not aliased: posts
The following errors occurred:

%Elasticsearch.Exception{col: nil, line: nil, message: \"reason\", query: nil, raw: %{\"error\" => %{\"reason\" => \"reason\", \"type\" => \"type\"}}, status: nil, type: \"type\"}\n
%Elasticsearch.Exception{status: nil, line: nil, col: nil, message: \"reason\", type: \"type\", query: nil, raw: %{\"error\" => %{\"reason\" => \"reason\", \"type\" => \"type\"}}}\n
""",
fn ->
rerun("elasticsearch.build", ["posts", "--cluster", inspect(ErrorCluster)])
Expand Down Expand Up @@ -183,7 +183,7 @@ defmodule Mix.Tasks.Elasticsearch.BuildTest do
"""
Index posts could not be created.

%Elasticsearch.Exception{col: nil, line: nil, message: \"Gateway Error\", query: nil, raw: nil, status: nil, type: nil}
%Elasticsearch.Exception{status: nil, line: nil, col: nil, message: \"Gateway Error\", type: nil, query: nil, raw: nil}
""",
fn ->
rerun("elasticsearch.build", ["posts", "--cluster", inspect(ErrorCluster)])
Expand All @@ -204,7 +204,7 @@ defmodule Mix.Tasks.Elasticsearch.BuildTest do

assert output =~ "Pausing 0ms between bulk pages"
resp = Elasticsearch.get!(TestCluster, "/posts/_search")
assert resp["hits"]["total"] == 10_000
assert resp["hits"]["total"]["value"] == 10_000
end

test "respects --bulk options" do
Expand All @@ -222,7 +222,7 @@ defmodule Mix.Tasks.Elasticsearch.BuildTest do

assert output =~ "Pausing 10ms between bulk pages"
resp = Elasticsearch.get!(TestCluster, "/posts/_search")
assert resp["hits"]["total"] == 2
assert resp["hits"]["total"]["value"] == 2
end

test "only keeps two index versions" do
Expand Down
36 changes: 17 additions & 19 deletions test/support/settings/posts.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
{
"mappings": {
"_doc": {
"properties": {
"title": {
"type": "text"
},
"body": {
"type": "text"
},
"author": {
"type": "text"
},
"doctype": {
"type": "join",
"relations": {
"post": "comment"
}
"mappings": {
"properties": {
"title": {
"type": "text"
},
"body": {
"type": "text"
},
"author": {
"type": "text"
},
"doctype": {
"type": "join",
"relations": {
"post": "comment"
}
}
}
}
}
}
}