elastic-esql 0.2.0 → 0.3.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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/elastic/esql.rb +31 -3
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99e718442d20298997082926d68a0a81fb7fa4caca2469438b1661f21134ea9f
4
- data.tar.gz: 6baf28b918cfead958e96b59dc2062e02d5702c20b232cfe7fdaf6bdb9aa5285
3
+ metadata.gz: ee4efdbcbcfd0ced3cc7d373b9fe58719f3434c995a75112ce5c2740509b8840
4
+ data.tar.gz: 4c11d6fd4dfd95b27e34bd189904c83abf469ac06c06a3672d170bac1ae1e30f
5
5
  SHA512:
6
- metadata.gz: e4dffbd00b997031a36c27a7edf0640e8f726e1d719ba35a98d37a3f15235b3c92a2a8e38ee5159557a97dc775177e0ba08ef4df35cfed1921cc53b682fe129e
7
- data.tar.gz: e1d9bd655f5d34016da2caf6a976c74dc9f57244782cbfc6700a8993f8dbbce37722c1cafe978c99a60f5b88daa6e99e1ae9015ed3347ca65d59f362d15f5dcc
6
+ metadata.gz: 3fa05ddee1fceb1f300e3c16ca6b8ab32fead629bf20e50d6f406694cdc97400d8bef450e0ef050dd86a95bbd9c1bf69b2384ca641b0605e2048eb86e66b549d
7
+ data.tar.gz: cb732b90ceb859d05872705bf777886d9b8a844bd82d7cbf5351203516b78e304f427ed727d1a8576966f87f999447fae9a880b6d7a5ea6d4b7efe3d60cd0cc5
data/lib/elastic/esql.rb CHANGED
@@ -21,6 +21,7 @@ require_relative 'dissect'
21
21
  require_relative 'drop'
22
22
  require_relative 'enrich'
23
23
  require_relative 'eval'
24
+ require_relative 'functions'
24
25
  require_relative 'grok'
25
26
  require_relative 'keep'
26
27
  require_relative 'limit'
@@ -30,12 +31,15 @@ require_relative 'rename'
30
31
  require_relative 'row'
31
32
  require_relative 'show'
32
33
  require_relative 'sort'
34
+ require_relative 'stats'
35
+ require_relative 'ts'
33
36
  require_relative 'where'
34
37
 
35
38
  module Elastic
36
39
  # @example
37
40
  # Elastic::ESQL.from('sample_data').sort_descending('@timestamp').limit(3).to_s
38
41
  # # => FROM 'sample_data' | SORT @timestamp desc | LIMIT 3
42
+ # rubocop:disable Metrics/ClassLength
39
43
  class ESQL
40
44
  include ChangePoint
41
45
  include Custom
@@ -51,8 +55,11 @@ module Elastic
51
55
  include Row
52
56
  include Show
53
57
  include Sort
58
+ include Stats
59
+ include TS
54
60
  include Where
55
- SOURCE_COMMANDS = [:from, :row, :show].freeze
61
+
62
+ SOURCE_COMMANDS = [:from, :row, :show, :ts].freeze
56
63
 
57
64
  def initialize
58
65
  @query = {}
@@ -74,8 +81,8 @@ module Elastic
74
81
  string_query
75
82
  end
76
83
 
77
- # Creates a new Enrich object to chain with +on+ and +with+. If other methods are chained to the
78
- # Enrich object, it returns calls it upon the ESQL object that instantiated it, and returns it.
84
+ # Creates a new Enrich object to chain with +on+ and +with+. If other method is chained to the
85
+ # Enrich object, it calls it upon the ESQL object that instantiated it, and returns it.
79
86
  # @return [Elastic::Enrich]
80
87
  def enrich(policy)
81
88
  @enriches ||= []
@@ -109,6 +116,10 @@ module Elastic
109
116
  new.row(*params)
110
117
  end
111
118
 
119
+ def self.ts(*params)
120
+ new.ts(*params)
121
+ end
122
+
112
123
  # Instance method to allow to update +from+ with +esql.from('different_source')+.
113
124
  # @param [String] index_pattern A list of indices, data streams or aliases. Supports wildcards and date math.
114
125
  def from(index_pattern)
@@ -122,6 +133,22 @@ module Elastic
122
133
  query
123
134
  end
124
135
 
136
+ # rubocop:disable Naming/MethodName, Naming/BinaryOperatorParameterName
137
+ def self.🐔(message)
138
+ "ROW CHICKEN(\"#{message}\")"
139
+ end
140
+
141
+ def 🐔(message)
142
+ self.class.🐔(message)
143
+ end
144
+
145
+ alias chicken 🐔
146
+
147
+ class << self
148
+ alias chicken 🐔
149
+ end
150
+ # rubocop:enable Naming/MethodName, Naming/BinaryOperatorParameterName
151
+
125
152
  private
126
153
 
127
154
  # Function for eval, row, and other functions that have one or more columns with values specified
@@ -182,4 +209,5 @@ module Elastic
182
209
  end.join(' | ')
183
210
  end
184
211
  end
212
+ # rubocop:enable Metrics/ClassLength
185
213
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic-esql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernando Briano
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  - !ruby/object:Gem::Version
105
105
  version: '0'
106
106
  requirements: []
107
- rubygems_version: 3.7.1
107
+ rubygems_version: 4.0.3
108
108
  specification_version: 4
109
109
  summary: Elastic ES|QL Query builder
110
110
  test_files: []