![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
This elasticsearch client is just all you need to index and search your data with persistent http connection. It don't tend to wrap elasticsearch dsl into ruby style dsl. Excon used for http staff. There is adapter for ActiveRecord models.
Add this line to your application's Gemfile:
gem 'es_client'
And then execute:
$ bundle
Or install it yourself as:
$ gem install es_client
Create index:
index = EsClient::Index.new('products')
index.create
Add document to index:
index.save_document('product', 1, {id: 1, name: 'Table', sku: '123'})
Fetch document:
index.find('product', 1)
Add few document with one query i.e. bulk index:
index.bulk(:index, 'product', [{id: 2, name: 'Chair'}, {id: 2, name: 'Lamp'}])
And, of course, search:
index.search(query: {query_string: {query: 'table OR chair'}}).decoded
EsClient.setup do |config|
# path to log file
config.log_path = Rails.root.join('log', 'elasticsearch.log')
# log level (successful requests logged in debug)
# config.logger.level = ::Logger::Severity::INFO unless Rails.env.development?
# log options, should be set to false in production for better performance
# `log_binary` - log binary data in bulk requests
# `log_response` - log response json, can be disabled in production
# `pretty` - pretty generate json in logs
# config.logger_options = {log_binary: true, log_response: true, pretty: true}
# application wide index prefix
config.index_prefix = 'my_app_name_here'
# enable indexing callbacks
# config.callbacks_enabled = true
# options passed to Excon initializer
# config.http_client_options = {persistent: true}
end
Include EsClient modules:
class User
include ::EsClient::ActiveRecord::Glue
include ::EsClient::ActiveRecord::Shortcuts
end
Create index:
User.es_client.index.create
Indexing performed on save
and destroy
callbacks:
user = User.create(name: 'alex')
Fetch record elasticsearch document:
user.es_doc
Search:
User.es_client.search(query: {query_string: {query: 'table OR chair'}})
Reindex all your data:
User.es_client_reindex
Or with progressbar (requires ruby-progressbar
gem):
User.es_client_reindex_with_progress
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that es_client 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.