
Security News
CISA’s 2025 SBOM Guidance Adds Hashes, Licenses, Tool Metadata, and Context
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Add this line to your application's Gemfile:
gem 'dry-elastic_model'
And then execute:
$ bundle
Or install it yourself as:
$ gem install dry-elastic_model
$ gem build dry-elastic_model.gemspec
$ gem push dry-elastic_model-${VERSION}.gem
This gem was created to provide a thin layer between Elasticsearch models mapping and Ruby objects. Right now, if you want to build your own Elasticsearch wrapper, you're on your own when it comes to creating document mappings and mapping ES documents to Ruby code, which can be painful especially if you want to also validate them before pushing.
Responsibilities of this library:
Sample model:
class FooBar < Dry::ElasticModel::Base
field :text_field, :text
field :newly_added_text_field, :text, allow_missing: true
field :keyword_field, :keyword, index: false
field :date_field, :date
field :long_field, :long
field :double_field, :double
field :boolean_field, :boolean
field :ip_field, :ip
list :list_text_field, :text
range :range_long_field, :long
end
This corresponds to following Elasticsearch mapping (calling Foo.mapping.to_json
):
{
"foobar": {
"properties": {
"text_field": {
"type": "text",
"index": "not_analyzed"
},
"newly_added_text_field": {
"type": "text",
"index": "not_analyzed"
},
"keyword_field": {
"type": "keyword",
"index": false
},
"date_field": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
},
"long_field": {
"type": "long"
},
"double_field": {
"type": "double"
},
"boolean_field": {
"type": "boolean"
},
"ip_field": {
"type": "ip"
},
"list_text_field": {
"type": "text"
},
"range_long_field": {
"type": "long_range"
}
}
}
}
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/koleksiuk/dry-elastic_model. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Dry::ElasticModel project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
FAQs
Unknown package
We found that dry-elastic_model demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.