eson-core 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. data/Rakefile +2 -2
  2. data/eson-core.gemspec +2 -1
  3. data/lib/eson-core.rb +5 -0
  4. data/lib/eson/api.rb +61 -12
  5. data/lib/eson/chainable.rb +3 -3
  6. data/lib/eson/client.rb +699 -180
  7. data/lib/eson/error.rb +10 -2
  8. data/lib/eson/request.rb +57 -16
  9. data/lib/eson/shared/cluster/health.rb +9 -2
  10. data/lib/eson/shared/cluster/nodes.rb +9 -1
  11. data/lib/eson/shared/cluster/shutdown.rb +9 -1
  12. data/lib/eson/shared/cluster/state.rb +9 -1
  13. data/lib/eson/shared/cluster/stats.rb +9 -1
  14. data/lib/eson/shared/core/bulk.rb +9 -1
  15. data/lib/eson/shared/core/count.rb +10 -1
  16. data/lib/eson/shared/core/delete.rb +10 -1
  17. data/lib/eson/shared/core/delete_by_query.rb +10 -1
  18. data/lib/eson/shared/core/explain.rb +44 -0
  19. data/lib/eson/shared/core/get.rb +9 -1
  20. data/lib/eson/shared/core/index.rb +13 -2
  21. data/lib/eson/shared/core/mget.rb +12 -3
  22. data/lib/eson/shared/core/more_like_this.rb +10 -1
  23. data/lib/eson/shared/core/msearch.rb +10 -1
  24. data/lib/eson/shared/core/percolate.rb +10 -1
  25. data/lib/eson/shared/core/scroll.rb +17 -0
  26. data/lib/eson/shared/core/search.rb +15 -3
  27. data/lib/eson/shared/core/simple_search.rb +9 -1
  28. data/lib/eson/shared/core/update.rb +33 -0
  29. data/lib/eson/shared/core/validate.rb +50 -0
  30. data/lib/eson/shared/indices/aliases.rb +37 -9
  31. data/lib/eson/shared/indices/analyze.rb +9 -2
  32. data/lib/eson/shared/indices/clear_cache.rb +9 -1
  33. data/lib/eson/shared/indices/close_index.rb +8 -1
  34. data/lib/eson/shared/indices/create_index.rb +10 -1
  35. data/lib/eson/shared/indices/delete_index.rb +8 -1
  36. data/lib/eson/shared/indices/delete_mapping.rb +9 -1
  37. data/lib/eson/shared/indices/delete_template.rb +8 -1
  38. data/lib/eson/shared/indices/exists.rb +8 -1
  39. data/lib/eson/shared/indices/flush.rb +9 -1
  40. data/lib/eson/shared/indices/get_aliases.rb +16 -0
  41. data/lib/eson/shared/indices/get_mapping.rb +9 -1
  42. data/lib/eson/shared/indices/get_settings.rb +8 -1
  43. data/lib/eson/shared/indices/get_template.rb +8 -1
  44. data/lib/eson/shared/indices/open_index.rb +8 -1
  45. data/lib/eson/shared/indices/optimize.rb +9 -1
  46. data/lib/eson/shared/indices/put_mapping.rb +10 -1
  47. data/lib/eson/shared/indices/put_template.rb +9 -1
  48. data/lib/eson/shared/indices/refresh.rb +9 -1
  49. data/lib/eson/shared/indices/segments.rb +8 -1
  50. data/lib/eson/shared/indices/snapshot.rb +8 -1
  51. data/lib/eson/shared/indices/stats.rb +9 -1
  52. data/lib/eson/shared/indices/status.rb +8 -1
  53. data/lib/eson/shared/indices/update_settings.rb +10 -1
  54. metadata +7 -8
@@ -1,12 +1,21 @@
1
1
  module Eson
2
2
  module Shared
3
+ # Requests using this API have the following properties:
4
+ #
5
+ # {include:Index#parameters}
6
+ # {include:Index#source_param}
7
+ # {include:Index#multi_index}
8
+ # {include:Index#multi_types}
3
9
  module Index
4
10
  extend API
5
11
 
12
+ # @!macro no_multi_index
6
13
  multi_index false
7
14
 
15
+ # @!macro source_param
8
16
  source_param :doc
9
17
 
18
+ # @!macro parameters
10
19
  parameters(
11
20
  :type,
12
21
  :id,
@@ -19,7 +28,9 @@ module Eson
19
28
  :replication,
20
29
  :consistency,
21
30
  :refresh,
22
- :timeout
31
+ :timeout,
32
+ :ttl,
33
+ :timestamp
23
34
  )
24
35
 
25
36
  alias :document :doc
@@ -30,4 +41,4 @@ module Eson
30
41
  end
31
42
  end
32
43
  end
33
- end
44
+ end
@@ -1,16 +1,25 @@
1
1
  module Eson
2
2
  module Shared
3
+ # Requests using this API have the following properties:
4
+ #
5
+ # {include:MultiGet#parameters}
6
+ # {include:MultiGet#source_param}
7
+ # {include:MultiGet#multi_index}
8
+ # {include:MultiGet#multi_types}
3
9
  module MultiGet
4
10
  extend API
5
-
11
+
12
+ # @!macro no_multi_index
6
13
  multi_index false
7
-
14
+
15
+ # @!macro source_param
8
16
  source_param :docs,
9
17
  :ids
10
18
 
19
+ # @!macro parameters
11
20
  parameters :type,
12
21
  :docs,
13
22
  :ids
14
23
  end
15
24
  end
16
- end
25
+ end
@@ -1,10 +1,18 @@
1
1
  module Eson
2
2
  module Shared
3
+ # Requests using this API have the following properties:
4
+ #
5
+ # @note {include:MoreLikeThis#parameters}
6
+ # @note {include:MoreLikeThis#source_param}
7
+ # @note {include:MoreLikeThis#multi_index}
8
+ # @note {include:MoreLikeThis#multi_types}
3
9
  module MoreLikeThis
4
10
  extend API
5
11
 
12
+ # @!macro no_multi_index
6
13
  multi_index false
7
14
 
15
+ # @!macro parameters
8
16
  parameters :id,
9
17
  :type,
10
18
  :mlt_fields,
@@ -35,6 +43,7 @@ module Eson
35
43
  :version,
36
44
  :min_score
37
45
 
46
+ # @!macro source_param
38
47
  source_param :timeout,
39
48
  :from,
40
49
  :size,
@@ -49,4 +58,4 @@ module Eson
49
58
  :min_score
50
59
  end
51
60
  end
52
- end
61
+ end
@@ -1,13 +1,22 @@
1
1
  module Eson
2
2
  module Shared
3
+ # Requests using this API have the following properties:
4
+ #
5
+ # @note {include:MultiSearch#parameters}
6
+ # @note {include:MultiSearch#source_param}
7
+ # @note {include:MultiSearch#multi_index}
8
+ # @note {include:MultiSearch#multi_types}
3
9
  module MultiSearch
4
10
  extend API
5
11
 
6
12
  attr_accessor :type
7
13
 
14
+ # @!macro multi_index
8
15
  multi_index true
9
16
 
17
+ # @!macro source_param
10
18
  source_param :msearch
19
+ # @!macro parameters
11
20
  parameters :msearch,
12
21
  :types
13
22
 
@@ -34,4 +43,4 @@ module Eson
34
43
  end
35
44
  end
36
45
  end
37
- end
46
+ end
@@ -1,18 +1,27 @@
1
1
  module Eson
2
2
  module Shared
3
+ # Requests using this API have the following properties:
4
+ #
5
+ # @note {include:Percolate#parameters}
6
+ # @note {include:Percolate#source_param}
7
+ # @note {include:Percolate#multi_index}
8
+ # @note {include:Percolate#multi_types}
3
9
  module Percolate
4
10
  extend API
5
11
 
12
+ # @!macro no_multi_index
6
13
  multi_index false
7
14
 
15
+ # @!macro parameters
8
16
  parameters :query,
9
17
  :doc,
10
18
  :prefer_local,
11
19
  :type,
12
20
  :index
13
21
 
22
+ # @!macro source_param
14
23
  source_param :doc, :query
15
24
 
16
25
  end
17
26
  end
18
- end
27
+ end
@@ -0,0 +1,17 @@
1
+ module Eson
2
+ module Shared
3
+ # Requests using this API have the following properties:
4
+ #
5
+ # {include:Scroll#parameters}
6
+ # {include:Scroll#source_param}
7
+ # {include:Scroll#multi_index}
8
+ # {include:Scroll#multi_types}
9
+ module Scroll
10
+ extend API
11
+
12
+ # @!macro parameters
13
+ parameters :scroll_id,
14
+ :scroll
15
+ end
16
+ end
17
+ end
@@ -1,12 +1,23 @@
1
1
  module Eson
2
2
  module Shared
3
+ # Requests using this API have the following properties:
4
+ #
5
+ # {include:Search#parameters}
6
+ # {include:Search#source_param}
7
+ # {include:Search#multi_index}
8
+ # {include:Search#multi_types}
3
9
  module Search
4
10
  extend API
5
11
 
6
12
  attr_accessor :type
7
13
 
14
+ # @!macro multi_index
8
15
  multi_index true
9
16
 
17
+ # @!macro multi_types
18
+ multi_types true
19
+
20
+ # @!macro source_param
10
21
  source_param :query,
11
22
  :timeout,
12
23
  :from,
@@ -23,6 +34,7 @@ module Eson
23
34
  :version,
24
35
  :min_score
25
36
 
37
+ # @!macro parameters
26
38
  parameters :timeout,
27
39
  :types,
28
40
  :routing,
@@ -39,14 +51,14 @@ module Eson
39
51
  :facets,
40
52
  :filter,
41
53
  :scroll,
42
- :scroll_id,
43
54
  :indices_boost,
44
55
  :explain,
45
56
  :version,
46
57
  :min_score,
47
58
  :q,
48
59
  :df,
49
- :analyzer
60
+ :analyzer,
61
+ :lowercase_expanded_terms
50
62
 
51
63
  def types
52
64
  if @types
@@ -59,4 +71,4 @@ module Eson
59
71
  end
60
72
  end
61
73
  end
62
- end
74
+ end
@@ -1,12 +1,20 @@
1
1
  module Eson
2
2
  module Shared
3
+ # Requests using this API have the following properties:
4
+ #
5
+ # {include:SimpleSearch#parameters}
6
+ # {include:SimpleSearch#source_param}
7
+ # {include:SimpleSearch#multi_index}
8
+ # {include:SimpleSearch#multi_types}
3
9
  module SimpleSearch
4
10
  extend API
5
11
 
12
+ # @!macro multi_index
6
13
  multi_index true
7
14
 
8
15
  attr_accessor :type
9
16
 
17
+ # @!macro parameters
10
18
  parameters :timeout,
11
19
  :types,
12
20
  :q,
@@ -32,4 +40,4 @@ module Eson
32
40
  end
33
41
  end
34
42
  end
35
- end
43
+ end
@@ -0,0 +1,33 @@
1
+ module Eson
2
+ module Shared
3
+ # Requests using this API have the following properties:
4
+ #
5
+ # {include:Update#parameters}
6
+ # {include:Update#source_param}
7
+ # {include:Update#multi_index}
8
+ # {include:Update#multi_types}
9
+ module Update
10
+ extend API
11
+
12
+ # @!macro no_multi_index
13
+ multi_index false
14
+
15
+ # @!macro parameters
16
+ parameters :timeout,
17
+ :type,
18
+ :routing,
19
+ :parent,
20
+ :id,
21
+ :consistency,
22
+ :percolate,
23
+ :refresh,
24
+ :script,
25
+ :params,
26
+ :retry_on_conflict
27
+
28
+ # @!macro source_param
29
+ source_param :script,
30
+ :params
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,50 @@
1
+ module Eson
2
+ module Shared
3
+ # Requests using this API have the following properties:
4
+ #
5
+ # {include:Validate#parameters}
6
+ # {include:Validate#source_param}
7
+ # {include:Validate#multi_index}
8
+ # {include:Validate#multi_types}
9
+ module Validate
10
+ extend API
11
+
12
+ attr_accessor :type
13
+
14
+ # @!macro multi_index
15
+ multi_index false
16
+
17
+ # @!macro multi_types
18
+ multi_types false
19
+
20
+ # @!macro source_param
21
+ source_param :query
22
+
23
+ # @!macro parameters
24
+ parameters :timeout,
25
+ :types,
26
+ :routing,
27
+ :query,
28
+ :from,
29
+ :size,
30
+ :search_type,
31
+ :sort,
32
+ :track_scores,
33
+ :highlight,
34
+ :fields,
35
+ :script_fields,
36
+ :preference,
37
+ :facets,
38
+ :filter,
39
+ :scroll,
40
+ :indices_boost,
41
+ :explain,
42
+ :version,
43
+ :min_score,
44
+ :q,
45
+ :df,
46
+ :analyzer,
47
+ :lowercase_expanded_terms
48
+ end
49
+ end
50
+ end
@@ -1,24 +1,52 @@
1
1
  module Eson
2
2
  module Shared
3
+ # Requests using this API have the following properties:
4
+ #
5
+ # {include:Aliases#parameters}
6
+ # {include:Aliases#source_param}
7
+ # {include:Aliases#multi_index}
8
+ # {include:Aliases#multi_types}
3
9
  module Aliases
4
10
  extend API
5
-
11
+
6
12
  no_indices true
7
-
13
+
14
+ # @!macro parameters
8
15
  parameters :actions
16
+ # @!macro source_param
9
17
  source_param [:actions]
10
-
11
- def add(index, aka)
12
- actions << {"add" => { "index" => index, "alias" => aka}}
18
+
19
+ # Adds an alias to the alias request. The aliased index and the alias
20
+ # are given directly, while further options can be provided in the
21
+ # options hash.
22
+ #
23
+ # @param index [String,Symbol] The index name.
24
+ # @param aka [String, Symbol] The aliased name.
25
+ # @options options [String, Symbol] :routing
26
+ # The routing parameter that should be used on all requests.
27
+ # @options options [String, Symbol] :search_routing
28
+ # Like routing, but only for search requests
29
+ # @options options [String, Symbol] :index_routing
30
+ # Like routing, but only for index requests
31
+ # @options options [Hash] :filter
32
+ # A filter definition to use on this alias
33
+ def add(index, aka, options = {})
34
+ actions << {:add => { :index => index, :alias => aka}.merge!(options)}
13
35
  end
14
-
36
+
37
+ # Removes an alias. To remove and alias, both the original index and
38
+ # the alias have to be given.
39
+ #
40
+ # @param index [String,Symbol] The index name.
41
+ # @param aka [String, Symbol] The aliased name.
15
42
  def remove(index, aka)
16
- actions << {"remove" => { "index" => index, "alias" => aka}}
43
+ actions << {:remove => { :index => index, :alias => aka}}
17
44
  end
18
-
45
+
46
+ #@api private
19
47
  def actions
20
48
  @actions ||= []
21
49
  end
22
50
  end
23
51
  end
24
- end
52
+ end
@@ -1,11 +1,18 @@
1
1
  module Eson
2
2
  module Shared
3
+ # Requests using this API have the following properties:
4
+ #
5
+ # {include:Analyze#parameters}
6
+ # {include:Analyze#source_param}
7
+ # {include:Analyze#multi_index}
8
+ # {include:Analyze#multi_types}
3
9
  module Analyze
4
10
  extend API
5
11
 
12
+ # @!macro no_multi_index
6
13
  multi_index false
7
14
 
8
- attr_accessor :text, :analyzer, :format
15
+ attr_accessor :text, :analyzer, :format, :tokenizer, :field
9
16
  end
10
17
  end
11
- end
18
+ end
@@ -1,13 +1,21 @@
1
1
  module Eson
2
2
  module Shared
3
+ # Requests using this API have the following properties:
4
+ #
5
+ # {include:ClearCache#parameters}
6
+ # {include:ClearCache#source_param}
7
+ # {include:ClearCache#multi_index}
8
+ # {include:ClearCache#multi_types}
3
9
  module ClearCache
4
10
  extend API
5
11
 
12
+ # @!macro multi_index
6
13
  multi_index true
7
14
 
15
+ # @!macro parameters
8
16
  parameters :filter,
9
17
  :field_data,
10
18
  :bloom
11
19
  end
12
20
  end
13
- end
21
+ end