es-grep 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/esgrep +15 -7
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/bin/esgrep
CHANGED
@@ -16,6 +16,10 @@ Main {
|
|
16
16
|
arity -2
|
17
17
|
}
|
18
18
|
|
19
|
+
option('raw', 'r'){
|
20
|
+
description 'Send a raw ElasticSearch REST query.'
|
21
|
+
}
|
22
|
+
|
19
23
|
option('limit', 'l'){
|
20
24
|
description 'The maximum number of results to return.'
|
21
25
|
argument :optional
|
@@ -115,14 +119,18 @@ Main {
|
|
115
119
|
end
|
116
120
|
|
117
121
|
def query_string(query)
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
122
|
+
if params[:raw].given?
|
123
|
+
query.to_json
|
124
|
+
else
|
125
|
+
{
|
126
|
+
"from" => 0, "size" => params[:limit].value,
|
127
|
+
"query" => {
|
128
|
+
"query_string" => {
|
129
|
+
"query" => query
|
130
|
+
}
|
123
131
|
}
|
124
|
-
}
|
125
|
-
|
132
|
+
}.to_json
|
133
|
+
end
|
126
134
|
end
|
127
135
|
|
128
136
|
}
|