stretchy-model 0.6.5 → 0.6.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +2 -1
- data/README.md +28 -10
- data/Rakefile +56 -0
- data/docs/.nojekyll +0 -0
- data/docs/README.md +147 -0
- data/docs/_coverpage.md +14 -0
- data/docs/_sidebar.md +14 -0
- data/docs/examples/_sidebar.md +15 -0
- data/docs/examples/data_analysis.md +216 -0
- data/docs/examples/semantic_search_with_llm.md +83 -0
- data/docs/examples/simple-ingest-pipeline.md +326 -0
- data/docs/guides/_sidebar.md +14 -0
- data/docs/guides/aggregations.md +142 -0
- data/docs/guides/machine-learning.md +154 -0
- data/docs/guides/models.md +372 -0
- data/docs/guides/pipelines.md +151 -0
- data/docs/guides/querying.md +361 -0
- data/docs/guides/quick-start.md +72 -0
- data/docs/guides/scopes.md +125 -0
- data/docs/index.html +113 -0
- data/docs/stretchy.cover.png +0 -0
- data/docs/stretchy.logo.png +0 -0
- data/docs/styles.css +90 -0
- data/lib/stretchy/attributes/transformers/keyword_transformer.rb +41 -35
- data/lib/stretchy/attributes/type/array.rb +24 -1
- data/lib/stretchy/attributes/type/base.rb +6 -2
- data/lib/stretchy/attributes/type/binary.rb +24 -17
- data/lib/stretchy/attributes/type/boolean.rb +29 -22
- data/lib/stretchy/attributes/type/completion.rb +18 -10
- data/lib/stretchy/attributes/type/constant_keyword.rb +35 -26
- data/lib/stretchy/attributes/type/date_time.rb +28 -17
- data/lib/stretchy/attributes/type/dense_vector.rb +46 -49
- data/lib/stretchy/attributes/type/flattened.rb +28 -19
- data/lib/stretchy/attributes/type/geo_point.rb +21 -12
- data/lib/stretchy/attributes/type/geo_shape.rb +21 -12
- data/lib/stretchy/attributes/type/hash.rb +24 -10
- data/lib/stretchy/attributes/type/histogram.rb +25 -0
- data/lib/stretchy/attributes/type/ip.rb +26 -17
- data/lib/stretchy/attributes/type/join.rb +16 -7
- data/lib/stretchy/attributes/type/keyword.rb +21 -26
- data/lib/stretchy/attributes/type/knn_vector.rb +47 -0
- data/lib/stretchy/attributes/type/match_only_text.rb +22 -1
- data/lib/stretchy/attributes/type/nested.rb +16 -11
- data/lib/stretchy/attributes/type/numeric/base.rb +30 -22
- data/lib/stretchy/attributes/type/numeric/byte.rb +20 -0
- data/lib/stretchy/attributes/type/numeric/double.rb +20 -0
- data/lib/stretchy/attributes/type/numeric/float.rb +20 -0
- data/lib/stretchy/attributes/type/numeric/half_float.rb +20 -0
- data/lib/stretchy/attributes/type/numeric/integer.rb +21 -1
- data/lib/stretchy/attributes/type/numeric/long.rb +20 -0
- data/lib/stretchy/attributes/type/numeric/scaled_float.rb +16 -7
- data/lib/stretchy/attributes/type/numeric/short.rb +20 -0
- data/lib/stretchy/attributes/type/numeric/unsigned_long.rb +21 -1
- data/lib/stretchy/attributes/type/percolator.rb +16 -4
- data/lib/stretchy/attributes/type/point.rb +19 -9
- data/lib/stretchy/attributes/type/range/base.rb +24 -1
- data/lib/stretchy/attributes/type/range/date_range.rb +21 -5
- data/lib/stretchy/attributes/type/range/double_range.rb +20 -4
- data/lib/stretchy/attributes/type/range/float_range.rb +21 -5
- data/lib/stretchy/attributes/type/range/integer_range.rb +20 -4
- data/lib/stretchy/attributes/type/range/ip_range.rb +20 -4
- data/lib/stretchy/attributes/type/range/long_range.rb +20 -4
- data/lib/stretchy/attributes/type/rank_feature.rb +16 -6
- data/lib/stretchy/attributes/type/rank_features.rb +16 -9
- data/lib/stretchy/attributes/type/search_as_you_type.rb +28 -18
- data/lib/stretchy/attributes/type/shape.rb +19 -9
- data/lib/stretchy/attributes/type/sparse_vector.rb +25 -21
- data/lib/stretchy/attributes/type/string.rb +42 -1
- data/lib/stretchy/attributes/type/text.rb +53 -28
- data/lib/stretchy/attributes/type/token_count.rb +21 -11
- data/lib/stretchy/attributes/type/version.rb +16 -6
- data/lib/stretchy/attributes/type/wildcard.rb +36 -25
- data/lib/stretchy/attributes.rb +29 -0
- data/lib/stretchy/delegation/gateway_delegation.rb +78 -0
- data/lib/stretchy/index_setting.rb +94 -0
- data/lib/stretchy/indexing/bulk.rb +75 -3
- data/lib/stretchy/model/callbacks.rb +1 -0
- data/lib/stretchy/model/common.rb +157 -0
- data/lib/stretchy/model/persistence.rb +144 -0
- data/lib/stretchy/model/refreshable.rb +26 -0
- data/lib/stretchy/pipeline.rb +2 -1
- data/lib/stretchy/pipelines/processor.rb +38 -36
- data/lib/stretchy/querying.rb +7 -8
- data/lib/stretchy/record.rb +5 -4
- data/lib/stretchy/relation.rb +229 -28
- data/lib/stretchy/relations/aggregation_methods/aggregation.rb +59 -0
- data/lib/stretchy/relations/aggregation_methods/avg.rb +45 -0
- data/lib/stretchy/relations/aggregation_methods/bucket_script.rb +47 -0
- data/lib/stretchy/relations/aggregation_methods/bucket_selector.rb +47 -0
- data/lib/stretchy/relations/aggregation_methods/bucket_sort.rb +47 -0
- data/lib/stretchy/relations/aggregation_methods/cardinality.rb +47 -0
- data/lib/stretchy/relations/aggregation_methods/children.rb +47 -0
- data/lib/stretchy/relations/aggregation_methods/composite.rb +41 -0
- data/lib/stretchy/relations/aggregation_methods/date_histogram.rb +53 -0
- data/lib/stretchy/relations/aggregation_methods/date_range.rb +53 -0
- data/lib/stretchy/relations/aggregation_methods/extended_stats.rb +48 -0
- data/lib/stretchy/relations/aggregation_methods/filter.rb +47 -0
- data/lib/stretchy/relations/aggregation_methods/filters.rb +47 -0
- data/lib/stretchy/relations/aggregation_methods/geo_bounds.rb +40 -0
- data/lib/stretchy/relations/aggregation_methods/geo_centroid.rb +40 -0
- data/lib/stretchy/relations/aggregation_methods/global.rb +39 -0
- data/lib/stretchy/relations/aggregation_methods/histogram.rb +43 -0
- data/lib/stretchy/relations/aggregation_methods/ip_range.rb +41 -0
- data/lib/stretchy/relations/aggregation_methods/max.rb +40 -0
- data/lib/stretchy/relations/aggregation_methods/min.rb +41 -0
- data/lib/stretchy/relations/aggregation_methods/missing.rb +40 -0
- data/lib/stretchy/relations/aggregation_methods/nested.rb +40 -0
- data/lib/stretchy/relations/aggregation_methods/percentile_ranks.rb +45 -0
- data/lib/stretchy/relations/aggregation_methods/percentiles.rb +45 -0
- data/lib/stretchy/relations/aggregation_methods/range.rb +42 -0
- data/lib/stretchy/relations/aggregation_methods/reverse_nested.rb +40 -0
- data/lib/stretchy/relations/aggregation_methods/sampler.rb +40 -0
- data/lib/stretchy/relations/aggregation_methods/scripted_metric.rb +43 -0
- data/lib/stretchy/relations/aggregation_methods/significant_terms.rb +45 -0
- data/lib/stretchy/relations/aggregation_methods/stats.rb +42 -0
- data/lib/stretchy/relations/aggregation_methods/sum.rb +42 -0
- data/lib/stretchy/relations/aggregation_methods/terms.rb +46 -0
- data/lib/stretchy/relations/aggregation_methods/top_hits.rb +42 -0
- data/lib/stretchy/relations/aggregation_methods/top_metrics.rb +44 -0
- data/lib/stretchy/relations/aggregation_methods/value_count.rb +41 -0
- data/lib/stretchy/relations/aggregation_methods/weighted_avg.rb +42 -0
- data/lib/stretchy/relations/aggregation_methods.rb +20 -749
- data/lib/stretchy/relations/finder_methods.rb +2 -18
- data/lib/stretchy/relations/null_relation.rb +55 -0
- data/lib/stretchy/relations/query_builder.rb +82 -36
- data/lib/stretchy/relations/query_methods/bind.rb +19 -0
- data/lib/stretchy/relations/query_methods/extending.rb +29 -0
- data/lib/stretchy/relations/query_methods/fields.rb +70 -0
- data/lib/stretchy/relations/query_methods/filter_query.rb +53 -0
- data/lib/stretchy/relations/query_methods/has_field.rb +40 -0
- data/lib/stretchy/relations/query_methods/highlight.rb +75 -0
- data/lib/stretchy/relations/query_methods/hybrid.rb +60 -0
- data/lib/stretchy/relations/query_methods/ids.rb +40 -0
- data/lib/stretchy/relations/query_methods/match.rb +52 -0
- data/lib/stretchy/relations/query_methods/must_not.rb +54 -0
- data/lib/stretchy/relations/query_methods/neural.rb +58 -0
- data/lib/stretchy/relations/query_methods/neural_sparse.rb +43 -0
- data/lib/stretchy/relations/query_methods/none.rb +21 -0
- data/lib/stretchy/relations/query_methods/or_filter.rb +21 -0
- data/lib/stretchy/relations/query_methods/order.rb +63 -0
- data/lib/stretchy/relations/query_methods/query_string.rb +44 -0
- data/lib/stretchy/relations/query_methods/regexp.rb +61 -0
- data/lib/stretchy/relations/query_methods/should.rb +51 -0
- data/lib/stretchy/relations/query_methods/size.rb +44 -0
- data/lib/stretchy/relations/query_methods/skip_callbacks.rb +47 -0
- data/lib/stretchy/relations/query_methods/source.rb +59 -0
- data/lib/stretchy/relations/query_methods/where.rb +113 -0
- data/lib/stretchy/relations/query_methods.rb +48 -569
- data/lib/stretchy/relations/scoping/default.rb +136 -0
- data/lib/stretchy/relations/scoping/named.rb +70 -0
- data/lib/stretchy/relations/scoping/scope_registry.rb +36 -0
- data/lib/stretchy/relations/scoping.rb +30 -0
- data/lib/stretchy/relations/search_option_methods.rb +2 -0
- data/lib/stretchy/version.rb +1 -1
- data/lib/stretchy.rb +17 -10
- metadata +111 -17
- data/lib/stretchy/common.rb +0 -38
- data/lib/stretchy/null_relation.rb +0 -53
- data/lib/stretchy/persistence.rb +0 -43
- data/lib/stretchy/refreshable.rb +0 -15
- data/lib/stretchy/scoping/default.rb +0 -134
- data/lib/stretchy/scoping/named.rb +0 -68
- data/lib/stretchy/scoping/scope_registry.rb +0 -34
- data/lib/stretchy/scoping.rb +0 -28
@@ -1,4 +1,24 @@
|
|
1
1
|
module Stretchy::Attributes::Type::Numeric
|
2
|
+
# The HalfFloat attribute type
|
3
|
+
#
|
4
|
+
# This class is used to define a half_float attribute for a model. It provides support for the Elasticsearch numeric data type, which is a type of data type that can hold half-precision 16-bit IEEE 754 floating point values.
|
5
|
+
#
|
6
|
+
# ### Parameters
|
7
|
+
#
|
8
|
+
# - `type:` `:half_float`.
|
9
|
+
#
|
10
|
+
# ---
|
11
|
+
#
|
12
|
+
# ### Examples
|
13
|
+
#
|
14
|
+
# #### Define a half_float attribute
|
15
|
+
#
|
16
|
+
# ```ruby
|
17
|
+
# class MyModel < StretchyModel
|
18
|
+
# attribute :rating, :half_float
|
19
|
+
# end
|
20
|
+
# ```
|
21
|
+
#
|
2
22
|
class HalfFloat < Base
|
3
23
|
def type
|
4
24
|
:half_float
|
@@ -1,5 +1,25 @@
|
|
1
1
|
module Stretchy::Attributes::Type::Numeric
|
2
|
-
|
2
|
+
# The HalfFloat attribute type
|
3
|
+
#
|
4
|
+
# This class is used to define a half_float attribute for a model. It provides support for the Elasticsearch numeric data type, which is a type of data type that can hold half-precision 16-bit IEEE 754 floating point values.
|
5
|
+
#
|
6
|
+
# ### Parameters
|
7
|
+
#
|
8
|
+
# - `type:` `:half_float`.
|
9
|
+
#
|
10
|
+
# ---
|
11
|
+
#
|
12
|
+
# ### Examples
|
13
|
+
#
|
14
|
+
# #### Define a half_float attribute
|
15
|
+
#
|
16
|
+
# ```ruby
|
17
|
+
# class MyModel < StretchyModel
|
18
|
+
# attribute :rating, :half_float
|
19
|
+
# end
|
20
|
+
# ```
|
21
|
+
#
|
22
|
+
class Integer < Base
|
3
23
|
def type
|
4
24
|
:integer
|
5
25
|
end
|
@@ -1,4 +1,24 @@
|
|
1
1
|
module Stretchy::Attributes::Type::Numeric
|
2
|
+
# The Long attribute type
|
3
|
+
#
|
4
|
+
# This class is used to define a long attribute for a model. It provides support for the Elasticsearch numeric data type, which is a type of data type that can hold long integer values.
|
5
|
+
#
|
6
|
+
# ### Parameters
|
7
|
+
#
|
8
|
+
# - `type:` `:long`.
|
9
|
+
#
|
10
|
+
# ---
|
11
|
+
#
|
12
|
+
# ### Examples
|
13
|
+
#
|
14
|
+
# #### Define a long attribute
|
15
|
+
#
|
16
|
+
# ```ruby
|
17
|
+
# class MyModel < StretchyModel
|
18
|
+
# attribute :population, :long
|
19
|
+
# end
|
20
|
+
# ```
|
21
|
+
#
|
2
22
|
class Long < Base
|
3
23
|
def type
|
4
24
|
:long
|
@@ -1,18 +1,27 @@
|
|
1
1
|
module Stretchy::Attributes::Type::Numeric
|
2
2
|
|
3
|
-
#
|
3
|
+
# The ScaledFloat attribute type
|
4
4
|
#
|
5
|
-
#
|
6
|
-
# :scaling_factor - The Integer scaling factor to use when encoding values. This parameter is required.
|
5
|
+
# This class is used to define a scaled_float attribute for a model. It provides support for the Elasticsearch numeric data type, which is a type of data type that can hold floating point values scaled by a fixed double precision factor.
|
7
6
|
#
|
8
|
-
#
|
7
|
+
# ### Parameters
|
9
8
|
#
|
10
|
-
#
|
11
|
-
#
|
9
|
+
# - `type:` `:scaled_float`.
|
10
|
+
# - `options:` The Hash of options for the attribute.
|
11
|
+
# - `:scaling_factor:` The Integer scaling factor to use when encoding values. This parameter is required.
|
12
|
+
#
|
13
|
+
# ---
|
14
|
+
#
|
15
|
+
# ### Examples
|
16
|
+
#
|
17
|
+
# #### Define a scaled_float attribute
|
18
|
+
#
|
19
|
+
# ```ruby
|
20
|
+
# class MyModel < StretchyModel
|
12
21
|
# attribute :rating, :scaled_float, scaling_factor: 10
|
13
22
|
# end
|
23
|
+
# ```
|
14
24
|
#
|
15
|
-
# Returns nothing.
|
16
25
|
class ScaledFloat < Base
|
17
26
|
OPTIONS = Base::OPTIONS + [:scaling_factor]
|
18
27
|
|
@@ -1,4 +1,24 @@
|
|
1
1
|
module Stretchy::Attributes::Type::Numeric
|
2
|
+
# The Short attribute type
|
3
|
+
#
|
4
|
+
# This class is used to define a short attribute for a model. It provides support for the Elasticsearch numeric data type, which is a type of data type that can hold short integer values.
|
5
|
+
#
|
6
|
+
# ### Parameters
|
7
|
+
#
|
8
|
+
# - `type:` `:short`.
|
9
|
+
#
|
10
|
+
# ---
|
11
|
+
#
|
12
|
+
# ### Examples
|
13
|
+
#
|
14
|
+
# #### Define a short attribute
|
15
|
+
#
|
16
|
+
# ```ruby
|
17
|
+
# class MyModel < StretchyModel
|
18
|
+
# attribute :short_number, :short
|
19
|
+
# end
|
20
|
+
# ```
|
21
|
+
#
|
2
22
|
class Short < Base
|
3
23
|
def type
|
4
24
|
:short
|
@@ -1,5 +1,25 @@
|
|
1
1
|
module Stretchy::Attributes::Type::Numeric
|
2
|
-
|
2
|
+
# The UnsignedLong attribute type
|
3
|
+
#
|
4
|
+
# This class is used to define an unsigned_long attribute for a model. It provides support for the Elasticsearch numeric data type, which is a type of data type that can hold unsigned long integer values.
|
5
|
+
#
|
6
|
+
# ### Parameters
|
7
|
+
#
|
8
|
+
# - `type:` `:unsigned_long`.
|
9
|
+
#
|
10
|
+
# ---
|
11
|
+
#
|
12
|
+
# ### Examples
|
13
|
+
#
|
14
|
+
# #### Define an unsigned_long attribute
|
15
|
+
#
|
16
|
+
# ```ruby
|
17
|
+
# class MyModel < Stretchy::Record
|
18
|
+
# attribute :large_number, :unsigned_long
|
19
|
+
# end
|
20
|
+
# ```
|
21
|
+
#
|
22
|
+
class UnsignedLong < Base
|
3
23
|
def type
|
4
24
|
:unsigned_long
|
5
25
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Stretchy::Attributes::Type
|
2
|
-
#
|
2
|
+
# The Percolator attribute type
|
3
|
+
#
|
4
|
+
# This class is used to define a percolator attribute for a model.
|
3
5
|
#
|
4
6
|
# The percolator field type parses a JSON structure into a native query and stores that query,
|
5
7
|
# so that the percolate query can use it to match provided documents.
|
@@ -8,13 +10,23 @@ module Stretchy::Attributes::Type
|
|
8
10
|
# The percolator field type has no settings. Just configuring the percolator field type
|
9
11
|
# is sufficient to instruct Elasticsearch to treat a field as a query.
|
10
12
|
#
|
11
|
-
#
|
13
|
+
# ### Parameters
|
14
|
+
#
|
15
|
+
# - `type:` `:percolator`.
|
16
|
+
# - `options:` The Hash of options for the attribute. This type does not have any specific options.
|
17
|
+
#
|
18
|
+
# ---
|
19
|
+
#
|
20
|
+
# ### Examples
|
21
|
+
#
|
22
|
+
# #### Define a percolator attribute
|
12
23
|
#
|
13
|
-
#
|
24
|
+
# ```ruby
|
25
|
+
# class MyModel < StretchyModel
|
14
26
|
# attribute :query, :percolator
|
15
27
|
# end
|
28
|
+
# ```
|
16
29
|
#
|
17
|
-
# Returns nothing.
|
18
30
|
class Percolator < Stretchy::Attributes::Type::Base
|
19
31
|
def type
|
20
32
|
:percolator
|
@@ -1,19 +1,29 @@
|
|
1
1
|
module Stretchy::Attributes::Type
|
2
|
-
#
|
2
|
+
# The Point attribute type
|
3
3
|
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
# :ignore_z_value - The Boolean indicating if the z value of three dimension points should be ignored. Defaults to true.
|
7
|
-
# :null_value - The Point value to be substituted for any explicit null values. Defaults to null.
|
4
|
+
# This class is used to define a point attribute for a model. It provides support for the Elasticsearch point data type, which is
|
5
|
+
# a type of data type that can hold geographical points (latitude and longitude).
|
8
6
|
#
|
9
|
-
#
|
7
|
+
# ### Parameters
|
10
8
|
#
|
11
|
-
#
|
12
|
-
#
|
9
|
+
# - `type:` `:point`.
|
10
|
+
# - `options:` The Hash of options for the attribute.
|
11
|
+
# - `:ignore_malformed:` The Boolean indicating if malformed points should be ignored. Defaults to false.
|
12
|
+
# - `:ignore_z_value:` The Boolean indicating if the z value of three dimension points should be ignored. Defaults to true.
|
13
|
+
# - `:null_value:` The Point value to be substituted for any explicit null values. Defaults to null.
|
14
|
+
#
|
15
|
+
# ---
|
16
|
+
#
|
17
|
+
# ### Examples
|
18
|
+
#
|
19
|
+
# #### Define a point attribute
|
20
|
+
#
|
21
|
+
# ```ruby
|
22
|
+
# class MyModel < StretchyModel
|
13
23
|
# attribute :location, :point, ignore_malformed: true
|
14
24
|
# end
|
25
|
+
# ```
|
15
26
|
#
|
16
|
-
# Returns nothing.
|
17
27
|
class Point < Stretchy::Attributes::Type::Base
|
18
28
|
OPTIONS = [:ignore_malformed, :ignore_z_value, :null_value]
|
19
29
|
|
@@ -1,5 +1,28 @@
|
|
1
1
|
module Stretchy::Attributes::Type::Range
|
2
|
-
|
2
|
+
# The Base class for range attribute types
|
3
|
+
#
|
4
|
+
# This class is used to define a base for range attribute types for a model. It provides support for the Elasticsearch range data types, which are types of data that can hold range of values.
|
5
|
+
#
|
6
|
+
# ### Parameters
|
7
|
+
#
|
8
|
+
# - `options:` The Hash of options for the attribute.
|
9
|
+
# - `:coerce:` The Boolean indicating if strings should be converted to numbers and fractions truncated for integers. Defaults to true.
|
10
|
+
# - `:index:` The Boolean indicating if the field should be quickly searchable. Defaults to true.
|
11
|
+
# - `:store:` The Boolean indicating if the field value should be stored and retrievable separately from the _source field. Defaults to false.
|
12
|
+
#
|
13
|
+
# ---
|
14
|
+
#
|
15
|
+
# ### Examples
|
16
|
+
#
|
17
|
+
# #### Define a range attribute
|
18
|
+
#
|
19
|
+
# ```ruby
|
20
|
+
# class MyModel < Stretchy::Record
|
21
|
+
# attribute :age_range, :integer_range, coerce: false
|
22
|
+
# end
|
23
|
+
# ```
|
24
|
+
#
|
25
|
+
class Base < Stretchy::Attributes::Type::Base #:nodoc:
|
3
26
|
OPTIONS = [:coerce, :index, :store]
|
4
27
|
|
5
28
|
def type
|
@@ -1,13 +1,29 @@
|
|
1
1
|
module Stretchy::Attributes::Type::Range
|
2
|
-
#
|
2
|
+
# The Range attribute type
|
3
3
|
#
|
4
|
-
#
|
4
|
+
# This class is used to define a range attribute for a model. It provides support for the Elasticsearch range data type, which is a type of data type that can hold range of values.
|
5
5
|
#
|
6
|
-
#
|
7
|
-
#
|
6
|
+
# ### Parameters
|
7
|
+
#
|
8
|
+
# - `type:` `:range`.
|
9
|
+
# - `options:` The Hash of options for the attribute.
|
10
|
+
# - `:doc_values:` The Boolean indicating if the field should be stored on disk in a column-stride fashion. This allows it to be used later for sorting, aggregations, or scripting. Defaults to true.
|
11
|
+
# - `:index:` The Boolean indicating if the field should be searchable. Defaults to true.
|
12
|
+
# - `:store:` The Boolean indicating if the field value should be stored and retrievable separately from the _source field. Defaults to false.
|
13
|
+
# - `:coerce:` The Boolean indicating if the field should automatically coerce the values to the data type. Defaults to true.
|
14
|
+
#
|
15
|
+
# ---
|
16
|
+
#
|
17
|
+
# ### Examples
|
18
|
+
#
|
19
|
+
# #### Define a range attribute
|
20
|
+
#
|
21
|
+
# ```ruby
|
22
|
+
# class MyModel < StretchyModel
|
23
|
+
# attribute :age_range, :range
|
8
24
|
# end
|
25
|
+
# ```
|
9
26
|
#
|
10
|
-
# Returns nothing.
|
11
27
|
class DateRange < Base
|
12
28
|
|
13
29
|
def type
|
@@ -1,13 +1,29 @@
|
|
1
1
|
module Stretchy::Attributes::Type::Range
|
2
|
-
#
|
2
|
+
# The DoubleRange attribute type
|
3
3
|
#
|
4
|
-
#
|
4
|
+
# This class is used to define a double_range attribute for a model. It provides support for the Elasticsearch range data type, which is a type of data type that can hold range of double values.
|
5
5
|
#
|
6
|
-
#
|
6
|
+
# ### Parameters
|
7
|
+
#
|
8
|
+
# - `type:` `:double_range`.
|
9
|
+
# - `options:` The Hash of options for the attribute.
|
10
|
+
# - `:doc_values:` The Boolean indicating if the field should be stored on disk in a column-stride fashion. This allows it to be used later for sorting, aggregations, or scripting. Defaults to true.
|
11
|
+
# - `:index:` The Boolean indicating if the field should be searchable. Defaults to true.
|
12
|
+
# - `:store:` The Boolean indicating if the field value should be stored and retrievable separately from the _source field. Defaults to false.
|
13
|
+
# - `:coerce:` The Boolean indicating if the field should automatically coerce the values to the data type. Defaults to true.
|
14
|
+
#
|
15
|
+
# ---
|
16
|
+
#
|
17
|
+
# ### Examples
|
18
|
+
#
|
19
|
+
# #### Define a double_range attribute
|
20
|
+
#
|
21
|
+
# ```ruby
|
22
|
+
# class MyModel < StretchyModel
|
7
23
|
# attribute :weight_range, :double_range
|
8
24
|
# end
|
25
|
+
# ```
|
9
26
|
#
|
10
|
-
# Returns nothing.
|
11
27
|
class DoubleRange < Base
|
12
28
|
|
13
29
|
def type
|
@@ -1,13 +1,29 @@
|
|
1
1
|
module Stretchy::Attributes::Type::Range
|
2
|
-
#
|
2
|
+
# The DoubleRange attribute type
|
3
3
|
#
|
4
|
-
#
|
4
|
+
# This class is used to define a double_range attribute for a model. It provides support for the Elasticsearch range data type, which is a type of data type that can hold range of double values.
|
5
5
|
#
|
6
|
-
#
|
7
|
-
#
|
6
|
+
# ### Parameters
|
7
|
+
#
|
8
|
+
# - `type:` `:double_range`.
|
9
|
+
# - `options:` The Hash of options for the attribute.
|
10
|
+
# - `:doc_values:` The Boolean indicating if the field should be stored on disk in a column-stride fashion. This allows it to be used later for sorting, aggregations, or scripting. Defaults to true.
|
11
|
+
# - `:index:` The Boolean indicating if the field should be searchable. Defaults to true.
|
12
|
+
# - `:store:` The Boolean indicating if the field value should be stored and retrievable separately from the _source field. Defaults to false.
|
13
|
+
# - `:coerce:` The Boolean indicating if the field should automatically coerce the values to the data type. Defaults to true.
|
14
|
+
#
|
15
|
+
# ---
|
16
|
+
#
|
17
|
+
# ### Examples
|
18
|
+
#
|
19
|
+
# #### Define a double_range attribute
|
20
|
+
#
|
21
|
+
# ```ruby
|
22
|
+
# class MyModel < StretchyModel
|
23
|
+
# attribute :weight_range, :double_range
|
8
24
|
# end
|
25
|
+
# ```
|
9
26
|
#
|
10
|
-
# Returns nothing.
|
11
27
|
class FloatRange < Base
|
12
28
|
def type
|
13
29
|
:float_range
|
@@ -1,13 +1,29 @@
|
|
1
1
|
module Stretchy::Attributes::Type::Range
|
2
|
-
#
|
2
|
+
# The IntegerRange attribute type
|
3
3
|
#
|
4
|
-
#
|
4
|
+
# This class is used to define an integer_range attribute for a model. It provides support for the Elasticsearch range data type, which is a type of data type that can hold range of integer values.
|
5
5
|
#
|
6
|
-
#
|
6
|
+
# ### Parameters
|
7
|
+
#
|
8
|
+
# - `type:` `:integer_range`.
|
9
|
+
# - `options:` The Hash of options for the attribute.
|
10
|
+
# - `:doc_values:` The Boolean indicating if the field should be stored on disk in a column-stride fashion. This allows it to be used later for sorting, aggregations, or scripting. Defaults to true.
|
11
|
+
# - `:index:` The Boolean indicating if the field should be searchable. Defaults to true.
|
12
|
+
# - `:store:` The Boolean indicating if the field value should be stored and retrievable separately from the _source field. Defaults to false.
|
13
|
+
# - `:coerce:` The Boolean indicating if the field should automatically coerce the values to the data type. Defaults to true.
|
14
|
+
#
|
15
|
+
# ---
|
16
|
+
#
|
17
|
+
# ### Examples
|
18
|
+
#
|
19
|
+
# #### Define an integer_range attribute
|
20
|
+
#
|
21
|
+
# ```ruby
|
22
|
+
# class MyModel < StretchyModel
|
7
23
|
# attribute :age_range, :integer_range
|
8
24
|
# end
|
25
|
+
# ```
|
9
26
|
#
|
10
|
-
# Returns nothing.
|
11
27
|
class IntegerRange < Base
|
12
28
|
def type
|
13
29
|
:integer_range
|
@@ -1,13 +1,29 @@
|
|
1
1
|
module Stretchy::Attributes::Type::Range
|
2
|
-
#
|
2
|
+
# The IpRange attribute type
|
3
3
|
#
|
4
|
-
#
|
4
|
+
# This class is used to define an ip_range attribute for a model. It provides support for the Elasticsearch range data type, which is a type of data type that can hold range of IP values.
|
5
5
|
#
|
6
|
-
#
|
6
|
+
# ### Parameters
|
7
|
+
#
|
8
|
+
# - `type:` `:ip_range`.
|
9
|
+
# - `options:` The Hash of options for the attribute.
|
10
|
+
# - `:doc_values:` The Boolean indicating if the field should be stored on disk in a column-stride fashion. This allows it to be used later for sorting, aggregations, or scripting. Defaults to true.
|
11
|
+
# - `:index:` The Boolean indicating if the field should be searchable. Defaults to true.
|
12
|
+
# - `:store:` The Boolean indicating if the field value should be stored and retrievable separately from the _source field. Defaults to false.
|
13
|
+
# - `:coerce:` The Boolean indicating if the field should automatically coerce the values to the data type. Defaults to true.
|
14
|
+
#
|
15
|
+
# ---
|
16
|
+
#
|
17
|
+
# ### Examples
|
18
|
+
#
|
19
|
+
# #### Define an ip_range attribute
|
20
|
+
#
|
21
|
+
# ```ruby
|
22
|
+
# class MyModel < StretchyModel
|
7
23
|
# attribute :ip_range, :ip_range
|
8
24
|
# end
|
25
|
+
# ```
|
9
26
|
#
|
10
|
-
# Returns nothing.
|
11
27
|
class IpRange < Base
|
12
28
|
def type
|
13
29
|
:ip_range
|
@@ -1,13 +1,29 @@
|
|
1
1
|
module Stretchy::Attributes::Type::Range
|
2
|
-
#
|
2
|
+
# The LongRange attribute type
|
3
3
|
#
|
4
|
-
#
|
4
|
+
# This class is used to define a long_range attribute for a model. It provides support for the Elasticsearch range data type, which is a type of data type that can hold range of long integer values.
|
5
5
|
#
|
6
|
-
#
|
6
|
+
# ### Parameters
|
7
|
+
#
|
8
|
+
# - `type:` `:long_range`.
|
9
|
+
# - `options:` The Hash of options for the attribute.
|
10
|
+
# - `:doc_values:` The Boolean indicating if the field should be stored on disk in a column-stride fashion. This allows it to be used later for sorting, aggregations, or scripting. Defaults to true.
|
11
|
+
# - `:index:` The Boolean indicating if the field should be searchable. Defaults to true.
|
12
|
+
# - `:store:` The Boolean indicating if the field value should be stored and retrievable separately from the _source field. Defaults to false.
|
13
|
+
# - `:coerce:` The Boolean indicating if the field should automatically coerce the values to the data type. Defaults to true.
|
14
|
+
#
|
15
|
+
# ---
|
16
|
+
#
|
17
|
+
# ### Examples
|
18
|
+
#
|
19
|
+
# #### Define a long_range attribute
|
20
|
+
#
|
21
|
+
# ```ruby
|
22
|
+
# class MyModel < StretchyModel
|
7
23
|
# attribute :population_range, :long_range
|
8
24
|
# end
|
25
|
+
# ```
|
9
26
|
#
|
10
|
-
# Returns nothing.
|
11
27
|
class LongRange < Base
|
12
28
|
def type
|
13
29
|
:long_range
|
@@ -1,16 +1,26 @@
|
|
1
1
|
module Stretchy::Attributes::Type
|
2
|
-
#
|
2
|
+
# The RankFeature attribute type
|
3
3
|
#
|
4
|
-
#
|
5
|
-
# :positive_score_impact - The Boolean indicating if features correlate positively with the score. If set to false, the score decreases with the value of the feature instead of increasing. Defaults to true.
|
4
|
+
# This class is used to define a rank_feature attribute for a model. It provides support for the Elasticsearch rank_feature data type, which is a type of data type that can hold numerical features that should impact the relevance score of the documents.
|
6
5
|
#
|
7
|
-
#
|
6
|
+
# ### Parameters
|
8
7
|
#
|
9
|
-
#
|
8
|
+
# - `type:` `:rank_feature`.
|
9
|
+
# - `options:` The Hash of options for the attribute.
|
10
|
+
# - `:positive_score_impact:` The Boolean indicating if features correlate positively with the score. If set to false, the score decreases with the value of the feature instead of increasing. Defaults to true.
|
11
|
+
#
|
12
|
+
# ---
|
13
|
+
#
|
14
|
+
# ### Examples
|
15
|
+
#
|
16
|
+
# #### Define a rank_feature attribute
|
17
|
+
#
|
18
|
+
# ```ruby
|
19
|
+
# class MyModel < StretchyModel
|
10
20
|
# attribute :url_length, :rank_feature, positive_score_impact: false
|
11
21
|
# end
|
22
|
+
# ```
|
12
23
|
#
|
13
|
-
# Returns nothing.
|
14
24
|
class RankFeature < Stretchy::Attributes::Type::Base
|
15
25
|
OPTIONS = [:positive_score_impact]
|
16
26
|
|
@@ -1,19 +1,26 @@
|
|
1
1
|
module Stretchy::Attributes::Type
|
2
|
-
#
|
2
|
+
# The RankFeatures attribute type
|
3
3
|
#
|
4
|
-
#
|
5
|
-
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
4
|
+
# This class is used to define a rank_features attribute for a model. It provides support for the Elasticsearch rank_features data type, which is a type of data type that can index numeric feature vectors, so that they can later be used to boost documents in queries with a rank_feature query. It is better suited when the list of features is sparse so that it wouldn’t be reasonable to add one field to the mappings for each of them.
|
5
|
+
#
|
6
|
+
# ### Parameters
|
7
|
+
#
|
8
|
+
# - `type:` `:rank_features`.
|
9
|
+
# - `options:` The Hash of options for the attribute.
|
10
|
+
# - `:positive_score_impact:` The Boolean indicating if features correlate positively with the score. If set to false, the score decreases with the value of the feature instead of increasing. Defaults to true.
|
11
|
+
#
|
12
|
+
# ---
|
13
|
+
#
|
14
|
+
# ### Examples
|
9
15
|
#
|
10
|
-
#
|
16
|
+
# #### Define a rank_features attribute
|
11
17
|
#
|
12
|
-
#
|
18
|
+
# ```ruby
|
19
|
+
# class MyModel < StretchyModel
|
13
20
|
# attribute :negative_reviews, :rank_features, positive_score_impact: false
|
14
21
|
# end
|
22
|
+
# ```
|
15
23
|
#
|
16
|
-
# Returns nothing.
|
17
24
|
class RankFeatures < Stretchy::Attributes::Type::Hash
|
18
25
|
OPTIONS = [:positive_score_impact]
|
19
26
|
|
@@ -1,25 +1,35 @@
|
|
1
1
|
module Stretchy::Attributes::Type
|
2
|
-
#
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
2
|
+
# The SearchAsYouType attribute type
|
3
|
+
#
|
4
|
+
# This class is used to define a search_as_you_type attribute for a model. This field type is optimized to provide out-of-the-box support for queries that serve an as-you-type completion use case.
|
5
|
+
#
|
6
|
+
# ### Parameters
|
7
|
+
#
|
8
|
+
# - `type:` `:search_as_you_type`.
|
9
|
+
# - `options:` The Hash of options for the attribute.
|
10
|
+
# - `:max_shingle_size:` The Integer indicating the largest shingle size to create. Valid values are 2 to 4. Defaults to 3.
|
11
|
+
# - `:analyzer:` The String analyzer to be used for text fields, both at index-time and at search-time. Defaults to the default index analyzer, or the standard analyzer.
|
12
|
+
# - `:index:` The Boolean indicating if the field should be searchable. Defaults to true.
|
13
|
+
# - `:index_options:` The String indicating what information should be stored in the index, for search and highlighting purposes. Defaults to 'positions'.
|
14
|
+
# - `:norms:` The Boolean indicating if field-length should be taken into account when scoring queries. Defaults to true.
|
15
|
+
# - `:store:` The Boolean indicating if the field value should be stored and retrievable separately from the _source field. Defaults to false.
|
16
|
+
# - `:search_analyzer:` The String analyzer that should be used at search time on text fields. Defaults to the analyzer setting.
|
17
|
+
# - `:search_quote_analyzer:` The String analyzer that should be used at search time when a phrase is encountered. Defaults to the search_analyzer setting.
|
18
|
+
# - `:similarity:` The String indicating which scoring algorithm or similarity should be used. Defaults to 'BM25'.
|
19
|
+
# - `:term_vector:` The String indicating if term vectors should be stored for the field. Defaults to 'no'.
|
20
|
+
#
|
21
|
+
# ---
|
22
|
+
#
|
23
|
+
# ### Examples
|
24
|
+
#
|
25
|
+
# #### Define a search_as_you_type attribute
|
26
|
+
#
|
27
|
+
# ```ruby
|
28
|
+
# class MyModel < StretchyModel
|
19
29
|
# attribute :name, :search_as_you_type, max_shingle_size: 4
|
20
30
|
# end
|
31
|
+
# ```
|
21
32
|
#
|
22
|
-
# Returns nothing.
|
23
33
|
class SearchAsYouType < Stretchy::Attributes::Type::Base
|
24
34
|
OPTIONS = [:max_shingle_size, :analyzer, :index, :index_options, :norms, :store, :search_analyzer, :search_quote_analyzer, :similarity, :term_vector]
|
25
35
|
|
@@ -1,19 +1,29 @@
|
|
1
1
|
module Stretchy::Attributes::Type
|
2
|
-
#
|
2
|
+
# The Shape attribute type
|
3
3
|
#
|
4
|
-
#
|
5
|
-
# :orientation - The String indicating how to interpret vertex order for polygons / multipolygons. Can be 'right', 'ccw', 'counterclockwise', 'left', 'cw', 'clockwise'. Defaults to 'ccw'.
|
6
|
-
# :ignore_malformed - The Boolean indicating if malformed GeoJSON or WKT shapes should be ignored. Defaults to false.
|
7
|
-
# :ignore_z_value - The Boolean indicating if the z value of three dimension points should be ignored. Defaults to true.
|
8
|
-
# :coerce - The Boolean indicating if unclosed linear rings in polygons will be automatically closed. Defaults to false.
|
4
|
+
# This class is used to define a shape attribute for a model. It provides support for the Elasticsearch shape data type, which is a type of data type that can hold complex shapes represented as GeoJSON or WKT.
|
9
5
|
#
|
10
|
-
#
|
6
|
+
# ### Parameters
|
11
7
|
#
|
12
|
-
#
|
8
|
+
# - `type:` `:shape`.
|
9
|
+
# - `options:` The Hash of options for the attribute.
|
10
|
+
# - `:orientation:` The String indicating how to interpret vertex order for polygons / multipolygons. Can be 'right', 'ccw', 'counterclockwise', 'left', 'cw', 'clockwise'. Defaults to 'ccw'.
|
11
|
+
# - `:ignore_malformed:` The Boolean indicating if malformed GeoJSON or WKT shapes should be ignored. Defaults to false.
|
12
|
+
# - `:ignore_z_value:` The Boolean indicating if the z value of three dimension points should be ignored. Defaults to true.
|
13
|
+
# - `:coerce:` The Boolean indicating if unclosed linear rings in polygons will be automatically closed. Defaults to false.
|
14
|
+
#
|
15
|
+
# ---
|
16
|
+
#
|
17
|
+
# ### Examples
|
18
|
+
#
|
19
|
+
# #### Define a shape attribute
|
20
|
+
#
|
21
|
+
# ```ruby
|
22
|
+
# class MyModel < StretchyModel
|
13
23
|
# attribute :boundary, :shape, orientation: 'cw'
|
14
24
|
# end
|
25
|
+
# ```
|
15
26
|
#
|
16
|
-
# Returns nothing.
|
17
27
|
class Shape < Stretchy::Attributes::Type::Base
|
18
28
|
OPTIONS = [:orientation, :ignore_malformed, :ignore_z_value, :coerce]
|
19
29
|
|