Skip to content

Commit fc645b2

Browse files
committed
[API] Data streams move to X-Pack
1 parent ce9471c commit fc645b2

File tree

13 files changed

+401
-281
lines changed

13 files changed

+401
-281
lines changed

elasticsearch-api/lib/elasticsearch/api/actions/indices/create_data_stream.rb

Lines changed: 0 additions & 49 deletions
This file was deleted.

elasticsearch-api/lib/elasticsearch/api/actions/indices/data_streams_stats.rb

Lines changed: 0 additions & 62 deletions
This file was deleted.

elasticsearch-api/lib/elasticsearch/api/actions/indices/delete_data_stream.rb

Lines changed: 0 additions & 48 deletions
This file was deleted.

elasticsearch-api/lib/elasticsearch/api/actions/indices/get_data_stream.rb

Lines changed: 0 additions & 50 deletions
This file was deleted.

elasticsearch-api/spec/elasticsearch/api/actions/indices/data_streams_stats_spec.rb

Lines changed: 0 additions & 72 deletions
This file was deleted.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Licensed to Elasticsearch B.V. under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Elasticsearch B.V. licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
module Elasticsearch
19+
module XPack
20+
module API
21+
module Indices
22+
module Actions
23+
# Creates or updates a data stream
24+
#
25+
# @option arguments [String] :name The name of the data stream
26+
# @option arguments [Hash] :headers Custom HTTP headers
27+
# @option arguments [Hash] :body The data stream definition
28+
#
29+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.x/data-streams.html
30+
#
31+
def create_data_stream(arguments = {})
32+
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
33+
34+
headers = arguments.delete(:headers) || {}
35+
36+
arguments = arguments.clone
37+
38+
_name = arguments.delete(:name)
39+
40+
method = Elasticsearch::API::HTTP_PUT
41+
path = "_data_stream/#{Elasticsearch::API::Utils.__listify(_name)}"
42+
params = {}
43+
44+
body = arguments[:body]
45+
perform_request(method, path, params, body, headers).body
46+
end
47+
end
48+
end
49+
end
50+
end
51+
end
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Licensed to Elasticsearch B.V. under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Elasticsearch B.V. licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
module Elasticsearch
19+
module XPack
20+
module API
21+
module Indices
22+
module Actions
23+
# Provides statistics on operations happening in a data stream.
24+
#
25+
# @option arguments [List] :name A comma-separated list of data stream names; use `_all` or empty string to perform the operation on all data streams
26+
# @option arguments [Hash] :headers Custom HTTP headers
27+
#
28+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.x/data-streams.html
29+
#
30+
def data_streams_stats(arguments = {})
31+
headers = arguments.delete(:headers) || {}
32+
33+
arguments = arguments.clone
34+
35+
_name = arguments.delete(:name)
36+
37+
method = Elasticsearch::API::HTTP_GET
38+
path = if _name
39+
"_data_stream/#{Elasticsearch::API::Utils.__listify(_name)}/_stats"
40+
else
41+
"_data_stream/_stats"
42+
end
43+
params = {}
44+
45+
body = nil
46+
perform_request(method, path, params, body, headers).body
47+
end
48+
end
49+
end
50+
end
51+
end
52+
end

0 commit comments

Comments
 (0)