elastic_adapter 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/.hound.yml +3 -0
- data/.rubocop.yml +8 -0
- data/.ruby.yml +261 -0
- data/.travis.yml +6 -0
- data/README.md +87 -8
- data/elastic_adapter.gemspec +1 -0
- data/examples/basic_usage.rb +164 -0
- data/lib/elastic_adapter/decoration/count_response.rb +0 -2
- data/lib/elastic_adapter/decoration/decorator.rb +2 -4
- data/lib/elastic_adapter/decoration/response_decorator_factory.rb +3 -6
- data/lib/elastic_adapter/decoration/search_response.rb +0 -2
- data/lib/elastic_adapter/decoration/suggestion_response.rb +0 -1
- data/lib/elastic_adapter/decoration/validation_response.rb +0 -1
- data/lib/elastic_adapter/document_type.rb +12 -2
- data/lib/elastic_adapter/index.rb +103 -10
- data/lib/elastic_adapter/response.rb +2 -1
- data/lib/elastic_adapter/version.rb +1 -1
- data/spec/cassettes/ElasticAdapter_Index/_count/empty_index/is_a_response.yml +1 -1
- data/spec/cassettes/ElasticAdapter_Index/_count/empty_index/{returs_the_amount_of_all_documents.yml → returns_the_amount_of_all_documents.yml} +1 -1
- data/spec/cassettes/ElasticAdapter_Index/_count/empty_index.yml +57 -0
- data/spec/cassettes/ElasticAdapter_Index/_count/not_empty_index/is_a_response.yml +1 -1
- data/spec/cassettes/ElasticAdapter_Index/_count/not_empty_index/returns_1.yml +1 -1
- data/spec/cassettes/ElasticAdapter_Index/_count/not_empty_index.yml +84 -0
- data/spec/cassettes/ElasticAdapter_Index/_create_index/index_is_present/response/has_an_exception.yml +2 -2
- data/spec/cassettes/ElasticAdapter_Index/_create_index/index_is_present/response/is_a_Response.yml +2 -2
- data/spec/cassettes/ElasticAdapter_Index/_create_index/index_is_present.yml +57 -0
- data/spec/cassettes/ElasticAdapter_Index/_create_index/index_not_present/response/has_no_exception.yml +2 -29
- data/spec/cassettes/ElasticAdapter_Index/_create_index/index_not_present/response/is_a_Response.yml +2 -29
- data/spec/cassettes/ElasticAdapter_Index/_create_index/index_not_present/response.yml +30 -0
- data/spec/cassettes/ElasticAdapter_Index/_delete_index/index_not_present/repsonse/has_an_exception.yml +1 -1
- data/spec/cassettes/ElasticAdapter_Index/_delete_index/index_not_present/repsonse/is_a_Response.yml +1 -1
- data/spec/cassettes/ElasticAdapter_Index/_delete_index/index_present/repsonse/has_no_exception.yml +1 -28
- data/spec/cassettes/ElasticAdapter_Index/_delete_index/index_present/repsonse/has_no_exceptionElasticAdapter_Index/_delete_index/index_present/repsonse.yml +30 -0
- data/spec/cassettes/ElasticAdapter_Index/_delete_index/index_present/repsonse/is_a_Response.yml +1 -28
- data/spec/cassettes/ElasticAdapter_Index/_delete_index/index_present/repsonse/is_a_ResponseElasticAdapter_Index/_delete_index/index_present/repsonse.yml +30 -0
- data/spec/cassettes/ElasticAdapter_Index/_get/document_exists/response/contains_the_document.yml +1 -1
- data/spec/cassettes/ElasticAdapter_Index/_get/document_exists.yml +84 -0
- data/spec/cassettes/ElasticAdapter_Index/_index/existing_document/doesn_t_change_the_document_count.yml +3 -3
- data/spec/cassettes/ElasticAdapter_Index/_index/existing_document/invokes_to_hash_on_the_document.yml +1 -1
- data/spec/cassettes/ElasticAdapter_Index/_index/existing_document/updates_the_document.yml +1 -1
- data/spec/cassettes/ElasticAdapter_Index/_index/existing_document.yml +84 -0
- data/spec/cassettes/ElasticAdapter_Index/_index/new_document/indexes_a_document.yml +3 -3
- data/spec/cassettes/ElasticAdapter_Index/_index/new_document/invokes_to_hash_on_the_document.yml +2 -2
- data/spec/cassettes/ElasticAdapter_Index/_index/new_document.yml +57 -0
- data/spec/cassettes/ElasticAdapter_Index/_search/match_all/returns_all_documents.yml +3 -3
- data/spec/cassettes/ElasticAdapter_Index/_search/zoo/returns_one_document.yml +3 -3
- data/spec/cassettes/ElasticAdapter_Index/_search/zoo/returns_the_wanted_document.yml +3 -3
- data/spec/cassettes/ElasticAdapter_Index/_search.yml +111 -0
- data/spec/cassettes/ElasticAdapter_Index/_suggest/query_ba_/returns_bar.yml +2 -2
- data/spec/cassettes/ElasticAdapter_Index/_suggest/query_ba_/returns_one_result.yml +2 -2
- data/spec/cassettes/ElasticAdapter_Index/_suggest.yml +111 -0
- data/spec/cassettes/ElasticAdapter_Index/_validate/invalid_query/is_a_response.yml +4 -3
- data/spec/cassettes/ElasticAdapter_Index/_validate/invalid_query/is_false.yml +1 -1
- data/spec/cassettes/ElasticAdapter_Index/_validate/valid_query/is_a_response.yml +3 -3
- data/spec/cassettes/ElasticAdapter_Index/_validate/valid_query/is_true.yml +1 -1
- data/spec/cassettes/ElasticAdapter_Index/_validate.yml +57 -0
- data/spec/index/count_spec.rb +46 -0
- data/spec/index/create_index_spec.rb +39 -0
- data/spec/index/delete_index_spec.rb +29 -0
- data/spec/index/get_spec.rb +29 -0
- data/spec/index/index_spec.rb +60 -0
- data/spec/index/search_spec.rb +37 -0
- data/spec/index/shared_context.rb +37 -0
- data/spec/index/shared_examples.rb +19 -0
- data/spec/index/suggest_spec.rb +44 -0
- data/spec/index/unit_spec.rb +69 -0
- data/spec/index/validate_spec.rb +55 -0
- data/spec/spec_helper.rb +6 -1
- data/spec/support/index_helper.rb +78 -0
- metadata +72 -7
- data/spec/index_spec.rb +0 -458
@@ -1,13 +1,24 @@
|
|
1
|
+
# rubocop:disable Metrics/LineLength
|
1
2
|
module ElasticAdapter
|
2
3
|
# This class is intended to hold information about
|
3
4
|
# a document in an elasticsearch index
|
4
5
|
#
|
5
6
|
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping.html Elasticsearch Mappings
|
6
7
|
#
|
8
|
+
# @example
|
9
|
+
# document_type = ElasticAdatper::DocumentType.new("test_doc", {
|
10
|
+
# test_doc: {
|
11
|
+
# properties: {
|
12
|
+
# name: {
|
13
|
+
# type: "string"
|
14
|
+
# }
|
15
|
+
# }
|
16
|
+
# }
|
17
|
+
# })
|
18
|
+
#
|
7
19
|
# @attr_reader [String] name the name of the document
|
8
20
|
# @attr_reader [Hash] mappings the mappings for the document
|
9
21
|
class DocumentType
|
10
|
-
|
11
22
|
attr_reader :name, :mappings
|
12
23
|
|
13
24
|
# @param [String] name
|
@@ -16,6 +27,5 @@ module ElasticAdapter
|
|
16
27
|
@name = name
|
17
28
|
@mappings = mappings
|
18
29
|
end
|
19
|
-
|
20
30
|
end
|
21
31
|
end
|
@@ -1,19 +1,60 @@
|
|
1
1
|
module ElasticAdapter
|
2
|
-
# This class encapsulates the access to
|
2
|
+
# This class encapsulates the access to a Elasticsearch::Transport::Client
|
3
|
+
# and provides an implementation of the repository pattern
|
4
|
+
#
|
5
|
+
# @attr_reader [String] name the name of the index
|
6
|
+
# @attr_reader [Hash] settings the index settings
|
7
|
+
# @attr_reader [DocumentType] document_type a DocumentType
|
8
|
+
# with the document name and it's mappings
|
9
|
+
# @attr_reader [String] url the url to elasticsearch
|
10
|
+
# @attr_reader [Boolean] log print degub log to $stdout
|
11
|
+
# @attr_reader [Client] client the client who
|
12
|
+
# handles the communication with elasticsearch
|
13
|
+
#
|
14
|
+
# @example Initialization
|
15
|
+
# index = ElasticAdapter::Index.new(
|
16
|
+
# name: "test_index",
|
17
|
+
# settings: { number_of_shards: 1 },
|
18
|
+
# document_type: ElasticAdapter::DocumentType.new("test_doc", mappings: {
|
19
|
+
# test_doc: {
|
20
|
+
# properties: {
|
21
|
+
# foo: { type: "string" }
|
22
|
+
# }
|
23
|
+
# }
|
24
|
+
# }
|
25
|
+
# ),
|
26
|
+
# url: "localhost:9200",
|
27
|
+
# log: true
|
28
|
+
# )
|
3
29
|
class Index
|
4
30
|
attr_reader :name, :settings, :document_type, :url, :log, :client
|
5
31
|
|
32
|
+
# @param [Hash] params
|
33
|
+
# @option params [String] :name required
|
34
|
+
# @option params [Hash] :settings required
|
35
|
+
# @option params [DocumentType] :document_type required
|
36
|
+
# @option params [String] :url required
|
37
|
+
# @option params [Boolean] :log required
|
38
|
+
# @option params [Client] client optional: A client. Defaults to
|
39
|
+
# Elasticsearch#Transport#Client
|
6
40
|
def initialize(params)
|
7
41
|
@name = params.fetch(:name)
|
8
42
|
@settings = params.fetch(:settings)
|
9
43
|
@document_type = params.fetch(:document_type)
|
10
44
|
@url = params.fetch(:url)
|
11
45
|
@log = params.fetch(:log)
|
12
|
-
@client = params.fetch
|
46
|
+
@client = params.fetch :client do
|
47
|
+
Elasticsearch::Client.new(url: url, log: log)
|
48
|
+
end
|
13
49
|
|
14
50
|
self
|
15
51
|
end
|
16
52
|
|
53
|
+
# Creates the index with it's settings and mappings
|
54
|
+
#
|
55
|
+
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-create-index.html Elasticsearch create index
|
56
|
+
#
|
57
|
+
# @return [ElasticAdapter::Response]
|
17
58
|
def create_index
|
18
59
|
handle_api_call do
|
19
60
|
client.indices.create(
|
@@ -26,18 +67,40 @@ module ElasticAdapter
|
|
26
67
|
end
|
27
68
|
end
|
28
69
|
|
70
|
+
# Deletes the index
|
71
|
+
#
|
72
|
+
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-delete-index.html Elasticsearch delete index
|
73
|
+
#
|
74
|
+
# @return [ElasticAdapter::Response]
|
29
75
|
def delete_index
|
30
76
|
handle_api_call do
|
31
77
|
client.indices.delete index: name
|
32
78
|
end
|
33
79
|
end
|
34
80
|
|
35
|
-
|
81
|
+
# Returns the document count for the index
|
82
|
+
#
|
83
|
+
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-count.html#search-count Elasticsearch count api
|
84
|
+
#
|
85
|
+
# @param [Hash] query a query to count the documents for a given query. Defaults to match all
|
86
|
+
# @return [Decoration::CountResponse] the count
|
87
|
+
def count(query = { query: { match_all: {} } })
|
36
88
|
handle_api_call do
|
37
89
|
client.count index: name, body: query
|
38
90
|
end
|
39
91
|
end
|
40
92
|
|
93
|
+
# Indexes a Hash or anything that responds to to_hash as a document
|
94
|
+
# in the index
|
95
|
+
#
|
96
|
+
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-index_.html Elasticsearch index api
|
97
|
+
#
|
98
|
+
# @example
|
99
|
+
# test_index = ElasticAdapter::Index.new(...)
|
100
|
+
# test_index.index(id: 1, name: "foo")
|
101
|
+
#
|
102
|
+
# @param [Hash] document
|
103
|
+
# @return [Response]
|
41
104
|
def index(document)
|
42
105
|
doc = document.to_hash.merge({})
|
43
106
|
|
@@ -55,6 +118,12 @@ module ElasticAdapter
|
|
55
118
|
response
|
56
119
|
end
|
57
120
|
|
121
|
+
# Returns the document with the given id from the index
|
122
|
+
#
|
123
|
+
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-get.html Elasticsearch get api
|
124
|
+
#
|
125
|
+
# @param [Integer] id
|
126
|
+
# @return [ElasticAdapter::HitDecorator]
|
58
127
|
def get(id)
|
59
128
|
handle_api_call do
|
60
129
|
client.get(
|
@@ -65,6 +134,16 @@ module ElasticAdapter
|
|
65
134
|
end
|
66
135
|
end
|
67
136
|
|
137
|
+
# Searches the index for documents matching the passed query.
|
138
|
+
#
|
139
|
+
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search.html Elasticsearch search apis
|
140
|
+
#
|
141
|
+
# @example
|
142
|
+
# test_index = ElasticAdatper::Index.new(...)
|
143
|
+
# test_index.seach(query: {match: {foo: "bar"}})
|
144
|
+
#
|
145
|
+
# @param [Hash] query
|
146
|
+
# @return [ElasticAdapter::SearchResponse]
|
68
147
|
def search(query)
|
69
148
|
handle_api_call do
|
70
149
|
client.search(
|
@@ -74,6 +153,16 @@ module ElasticAdapter
|
|
74
153
|
end
|
75
154
|
end
|
76
155
|
|
156
|
+
# Searches the index for suggestions for the passed suggest query
|
157
|
+
#
|
158
|
+
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-suggesters.html Elasticsearch suggesters
|
159
|
+
#
|
160
|
+
# @example
|
161
|
+
# test_index = ElasticAdatper::Index.new(...)
|
162
|
+
# test_index.seach(name_suggestions: {text: "foo", completion: {field: "name"}})
|
163
|
+
#
|
164
|
+
# @param [Hash] query
|
165
|
+
# @return [ElasticAdapter::SuggestResponse]
|
77
166
|
def suggest(query)
|
78
167
|
handle_api_call do
|
79
168
|
client.suggest(
|
@@ -83,6 +172,12 @@ module ElasticAdapter
|
|
83
172
|
end
|
84
173
|
end
|
85
174
|
|
175
|
+
# Validates the passed query
|
176
|
+
#
|
177
|
+
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-validate.html Elasticsearch validate api
|
178
|
+
#
|
179
|
+
# @param [Hash] query
|
180
|
+
# @return [ElasticAdapter::ValidationResponse]
|
86
181
|
def validate(query)
|
87
182
|
handle_api_call do
|
88
183
|
client.indices.validate_query(
|
@@ -96,13 +191,11 @@ module ElasticAdapter
|
|
96
191
|
private
|
97
192
|
|
98
193
|
def handle_api_call
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
)
|
105
|
-
end
|
194
|
+
Response.new(yield).decorate
|
195
|
+
rescue Elasticsearch::Transport::Transport::Error => e
|
196
|
+
Response.new(
|
197
|
+
exception: e
|
198
|
+
)
|
106
199
|
end
|
107
200
|
end
|
108
201
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module ElasticAdapter
|
2
2
|
# Serves to wrap the responses from elasticsearch
|
3
3
|
class Response < ::ElasticAdapter::Decoration::Decorator
|
4
|
-
|
5
4
|
# Checks if the operation was successfull
|
6
5
|
#
|
7
6
|
# @return [Boolean]
|
@@ -32,6 +31,8 @@ module ElasticAdapter
|
|
32
31
|
# @param [Hash] hash
|
33
32
|
# @return [Hash]
|
34
33
|
def alter_object(object)
|
34
|
+
return object unless [Hash, Array].include? object.class
|
35
|
+
|
35
36
|
object.inject({}) do |result, (key, value)|
|
36
37
|
new_value = nil
|
37
38
|
|
@@ -0,0 +1,57 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: put
|
5
|
+
uri: http://localhost:9200/test_index
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"mappings":{"test_doc":{"properties":{"foo":{"type":"string"},"foo_suggest":{"type":"completion"}}}},"settings":{}}'
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.1
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Content-Type:
|
22
|
+
- application/json; charset=UTF-8
|
23
|
+
Content-Length:
|
24
|
+
- '21'
|
25
|
+
body:
|
26
|
+
encoding: UTF-8
|
27
|
+
string: '{"acknowledged":true}'
|
28
|
+
http_version:
|
29
|
+
recorded_at: Sat, 07 Feb 2015 19:44:05 GMT
|
30
|
+
- request:
|
31
|
+
method: delete
|
32
|
+
uri: http://localhost:9200/test_index
|
33
|
+
body:
|
34
|
+
encoding: US-ASCII
|
35
|
+
string: ''
|
36
|
+
headers:
|
37
|
+
User-Agent:
|
38
|
+
- Faraday v0.9.1
|
39
|
+
Accept-Encoding:
|
40
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
41
|
+
Accept:
|
42
|
+
- "*/*"
|
43
|
+
response:
|
44
|
+
status:
|
45
|
+
code: 200
|
46
|
+
message: OK
|
47
|
+
headers:
|
48
|
+
Content-Type:
|
49
|
+
- application/json; charset=UTF-8
|
50
|
+
Content-Length:
|
51
|
+
- '21'
|
52
|
+
body:
|
53
|
+
encoding: UTF-8
|
54
|
+
string: '{"acknowledged":true}'
|
55
|
+
http_version:
|
56
|
+
recorded_at: Sat, 07 Feb 2015 19:44:08 GMT
|
57
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,84 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: put
|
5
|
+
uri: http://localhost:9200/test_index
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"mappings":{"test_doc":{"properties":{"foo":{"type":"string"},"foo_suggest":{"type":"completion"}}}},"settings":{}}'
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.1
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Content-Type:
|
22
|
+
- application/json; charset=UTF-8
|
23
|
+
Content-Length:
|
24
|
+
- '21'
|
25
|
+
body:
|
26
|
+
encoding: UTF-8
|
27
|
+
string: '{"acknowledged":true}'
|
28
|
+
http_version:
|
29
|
+
recorded_at: Sat, 07 Feb 2015 19:44:08 GMT
|
30
|
+
- request:
|
31
|
+
method: post
|
32
|
+
uri: http://localhost:9200/test_index/test_doc
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: '{"foo":"bar"}'
|
36
|
+
headers:
|
37
|
+
User-Agent:
|
38
|
+
- Faraday v0.9.1
|
39
|
+
Accept-Encoding:
|
40
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
41
|
+
Accept:
|
42
|
+
- "*/*"
|
43
|
+
response:
|
44
|
+
status:
|
45
|
+
code: 201
|
46
|
+
message: Created
|
47
|
+
headers:
|
48
|
+
Content-Type:
|
49
|
+
- application/json; charset=UTF-8
|
50
|
+
Content-Length:
|
51
|
+
- '99'
|
52
|
+
body:
|
53
|
+
encoding: UTF-8
|
54
|
+
string: '{"_index":"test_index","_type":"test_doc","_id":"AUtlkiRsm1jcpZVj70ky","_version":1,"created":true}'
|
55
|
+
http_version:
|
56
|
+
recorded_at: Sat, 07 Feb 2015 19:44:11 GMT
|
57
|
+
- request:
|
58
|
+
method: delete
|
59
|
+
uri: http://localhost:9200/test_index
|
60
|
+
body:
|
61
|
+
encoding: US-ASCII
|
62
|
+
string: ''
|
63
|
+
headers:
|
64
|
+
User-Agent:
|
65
|
+
- Faraday v0.9.1
|
66
|
+
Accept-Encoding:
|
67
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
68
|
+
Accept:
|
69
|
+
- "*/*"
|
70
|
+
response:
|
71
|
+
status:
|
72
|
+
code: 200
|
73
|
+
message: OK
|
74
|
+
headers:
|
75
|
+
Content-Type:
|
76
|
+
- application/json; charset=UTF-8
|
77
|
+
Content-Length:
|
78
|
+
- '21'
|
79
|
+
body:
|
80
|
+
encoding: UTF-8
|
81
|
+
string: '{"acknowledged":true}'
|
82
|
+
http_version:
|
83
|
+
recorded_at: Sat, 07 Feb 2015 19:44:14 GMT
|
84
|
+
recorded_with: VCR 2.9.3
|
@@ -5,7 +5,7 @@ http_interactions:
|
|
5
5
|
uri: http://localhost:9200/test_index
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string: '{"mappings":{"test_index":{"properties":{"foo":{"type":"string"}}}},"settings":{"number_of_shards":1}}'
|
8
|
+
string: '{"mappings":{"test_index":{"properties":{"foo":{"type":"string","foo_suggest":{"type":"completion"}}}}},"settings":{"number_of_shards":1}}'
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
11
|
- Faraday v0.9.1
|
@@ -26,5 +26,5 @@ http_interactions:
|
|
26
26
|
encoding: UTF-8
|
27
27
|
string: '{"error":"IndexAlreadyExistsException[[test_index] already exists]","status":400}'
|
28
28
|
http_version:
|
29
|
-
recorded_at:
|
29
|
+
recorded_at: Sat, 07 Feb 2015 19:44:17 GMT
|
30
30
|
recorded_with: VCR 2.9.3
|
data/spec/cassettes/ElasticAdapter_Index/_create_index/index_is_present/response/is_a_Response.yml
CHANGED
@@ -5,7 +5,7 @@ http_interactions:
|
|
5
5
|
uri: http://localhost:9200/test_index
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string: '{"mappings":{"test_index":{"properties":{"foo":{"type":"string"}}}},"settings":{"number_of_shards":1}}'
|
8
|
+
string: '{"mappings":{"test_index":{"properties":{"foo":{"type":"string","foo_suggest":{"type":"completion"}}}}},"settings":{"number_of_shards":1}}'
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
11
|
- Faraday v0.9.1
|
@@ -26,5 +26,5 @@ http_interactions:
|
|
26
26
|
encoding: UTF-8
|
27
27
|
string: '{"error":"IndexAlreadyExistsException[[test_index] already exists]","status":400}'
|
28
28
|
http_version:
|
29
|
-
recorded_at:
|
29
|
+
recorded_at: Sat, 07 Feb 2015 19:44:17 GMT
|
30
30
|
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,57 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: put
|
5
|
+
uri: http://localhost:9200/test_index
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"mappings":{"test_doc":{"properties":{"foo":{"type":"string"},"foo_suggest":{"type":"completion"}}}},"settings":{}}'
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.1
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Content-Type:
|
22
|
+
- application/json; charset=UTF-8
|
23
|
+
Content-Length:
|
24
|
+
- '21'
|
25
|
+
body:
|
26
|
+
encoding: UTF-8
|
27
|
+
string: '{"acknowledged":true}'
|
28
|
+
http_version:
|
29
|
+
recorded_at: Sat, 07 Feb 2015 19:44:14 GMT
|
30
|
+
- request:
|
31
|
+
method: delete
|
32
|
+
uri: http://localhost:9200/test_index
|
33
|
+
body:
|
34
|
+
encoding: US-ASCII
|
35
|
+
string: ''
|
36
|
+
headers:
|
37
|
+
User-Agent:
|
38
|
+
- Faraday v0.9.1
|
39
|
+
Accept-Encoding:
|
40
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
41
|
+
Accept:
|
42
|
+
- "*/*"
|
43
|
+
response:
|
44
|
+
status:
|
45
|
+
code: 200
|
46
|
+
message: OK
|
47
|
+
headers:
|
48
|
+
Content-Type:
|
49
|
+
- application/json; charset=UTF-8
|
50
|
+
Content-Length:
|
51
|
+
- '21'
|
52
|
+
body:
|
53
|
+
encoding: UTF-8
|
54
|
+
string: '{"acknowledged":true}'
|
55
|
+
http_version:
|
56
|
+
recorded_at: Sat, 07 Feb 2015 19:44:17 GMT
|
57
|
+
recorded_with: VCR 2.9.3
|
@@ -5,7 +5,7 @@ http_interactions:
|
|
5
5
|
uri: http://localhost:9200/test_index
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string: '{"mappings":{"test_index":{"properties":{"foo":{"type":"string"}}}},"settings":{"number_of_shards":1}}'
|
8
|
+
string: '{"mappings":{"test_index":{"properties":{"foo":{"type":"string","foo_suggest":{"type":"completion"}}}}},"settings":{"number_of_shards":1}}'
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
11
|
- Faraday v0.9.1
|
@@ -26,32 +26,5 @@ http_interactions:
|
|
26
26
|
encoding: UTF-8
|
27
27
|
string: '{"acknowledged":true}'
|
28
28
|
http_version:
|
29
|
-
recorded_at:
|
30
|
-
- request:
|
31
|
-
method: delete
|
32
|
-
uri: http://localhost:9200/test_index
|
33
|
-
body:
|
34
|
-
encoding: US-ASCII
|
35
|
-
string: ''
|
36
|
-
headers:
|
37
|
-
User-Agent:
|
38
|
-
- Faraday v0.9.1
|
39
|
-
Accept-Encoding:
|
40
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
41
|
-
Accept:
|
42
|
-
- "*/*"
|
43
|
-
response:
|
44
|
-
status:
|
45
|
-
code: 200
|
46
|
-
message: OK
|
47
|
-
headers:
|
48
|
-
Content-Type:
|
49
|
-
- application/json; charset=UTF-8
|
50
|
-
Content-Length:
|
51
|
-
- '21'
|
52
|
-
body:
|
53
|
-
encoding: UTF-8
|
54
|
-
string: '{"acknowledged":true}'
|
55
|
-
http_version:
|
56
|
-
recorded_at: Thu, 05 Feb 2015 19:30:15 GMT
|
29
|
+
recorded_at: Sat, 07 Feb 2015 19:44:17 GMT
|
57
30
|
recorded_with: VCR 2.9.3
|
data/spec/cassettes/ElasticAdapter_Index/_create_index/index_not_present/response/is_a_Response.yml
CHANGED
@@ -5,7 +5,7 @@ http_interactions:
|
|
5
5
|
uri: http://localhost:9200/test_index
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string: '{"mappings":{"test_index":{"properties":{"foo":{"type":"string"}}}},"settings":{"number_of_shards":1}}'
|
8
|
+
string: '{"mappings":{"test_index":{"properties":{"foo":{"type":"string","foo_suggest":{"type":"completion"}}}}},"settings":{"number_of_shards":1}}'
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
11
|
- Faraday v0.9.1
|
@@ -26,32 +26,5 @@ http_interactions:
|
|
26
26
|
encoding: UTF-8
|
27
27
|
string: '{"acknowledged":true}'
|
28
28
|
http_version:
|
29
|
-
recorded_at:
|
30
|
-
- request:
|
31
|
-
method: delete
|
32
|
-
uri: http://localhost:9200/test_index
|
33
|
-
body:
|
34
|
-
encoding: US-ASCII
|
35
|
-
string: ''
|
36
|
-
headers:
|
37
|
-
User-Agent:
|
38
|
-
- Faraday v0.9.1
|
39
|
-
Accept-Encoding:
|
40
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
41
|
-
Accept:
|
42
|
-
- "*/*"
|
43
|
-
response:
|
44
|
-
status:
|
45
|
-
code: 200
|
46
|
-
message: OK
|
47
|
-
headers:
|
48
|
-
Content-Type:
|
49
|
-
- application/json; charset=UTF-8
|
50
|
-
Content-Length:
|
51
|
-
- '21'
|
52
|
-
body:
|
53
|
-
encoding: UTF-8
|
54
|
-
string: '{"acknowledged":true}'
|
55
|
-
http_version:
|
56
|
-
recorded_at: Thu, 05 Feb 2015 19:30:15 GMT
|
29
|
+
recorded_at: Sat, 07 Feb 2015 19:44:17 GMT
|
57
30
|
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: delete
|
5
|
+
uri: http://localhost:9200/test_index
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.1
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Content-Type:
|
22
|
+
- application/json; charset=UTF-8
|
23
|
+
Content-Length:
|
24
|
+
- '21'
|
25
|
+
body:
|
26
|
+
encoding: UTF-8
|
27
|
+
string: '{"acknowledged":true}'
|
28
|
+
http_version:
|
29
|
+
recorded_at: Sat, 07 Feb 2015 19:44:17 GMT
|
30
|
+
recorded_with: VCR 2.9.3
|
data/spec/cassettes/ElasticAdapter_Index/_delete_index/index_present/repsonse/has_no_exception.yml
CHANGED
@@ -1,32 +1,5 @@
|
|
1
1
|
---
|
2
2
|
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: put
|
5
|
-
uri: http://localhost:9200/test_index
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: '{"mappings":{"test_doc":{"properties":{"foo":{"type":"string"}}}},"settings":{}}'
|
9
|
-
headers:
|
10
|
-
User-Agent:
|
11
|
-
- Faraday v0.9.1
|
12
|
-
Accept-Encoding:
|
13
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
-
Accept:
|
15
|
-
- "*/*"
|
16
|
-
response:
|
17
|
-
status:
|
18
|
-
code: 200
|
19
|
-
message: OK
|
20
|
-
headers:
|
21
|
-
Content-Type:
|
22
|
-
- application/json; charset=UTF-8
|
23
|
-
Content-Length:
|
24
|
-
- '21'
|
25
|
-
body:
|
26
|
-
encoding: UTF-8
|
27
|
-
string: '{"acknowledged":true}'
|
28
|
-
http_version:
|
29
|
-
recorded_at: Thu, 05 Feb 2015 19:30:15 GMT
|
30
3
|
- request:
|
31
4
|
method: delete
|
32
5
|
uri: http://localhost:9200/test_index
|
@@ -53,5 +26,5 @@ http_interactions:
|
|
53
26
|
encoding: UTF-8
|
54
27
|
string: '{"acknowledged":true}'
|
55
28
|
http_version:
|
56
|
-
recorded_at:
|
29
|
+
recorded_at: Sat, 07 Feb 2015 19:44:23 GMT
|
57
30
|
recorded_with: VCR 2.9.3
|