Module: Elastictastic

Defined in:
lib/elastictastic.rb,
lib/elastictastic/util.rb,
lib/elastictastic/dirty.rb,
lib/elastictastic/field.rb,
lib/elastictastic/index.rb,
lib/elastictastic/scope.rb,
lib/elastictastic/client.rb,
lib/elastictastic/errors.rb,
lib/elastictastic/scoped.rb,
lib/elastictastic/search.rb,
lib/elastictastic/railtie.rb,
lib/elastictastic/version.rb,
lib/elastictastic/document.rb,
lib/elastictastic/observer.rb,
lib/elastictastic/resource.rb,
lib/elastictastic/callbacks.rb,
lib/elastictastic/observing.rb,
lib/elastictastic/middleware.rb,
lib/elastictastic/properties.rb,
lib/elastictastic/association.rb,
lib/elastictastic/persistence.rb,
lib/elastictastic/validations.rb,
lib/elastictastic/parent_child.rb,
lib/elastictastic/server_error.rb,
lib/elastictastic/test_helpers.rb,
lib/elastictastic/configuration.rb,
lib/elastictastic/scope_builder.rb,
lib/elastictastic/nested_document.rb,
lib/elastictastic/child_collection_proxy.rb,
lib/elastictastic/mass_assignment_security.rb,
lib/elastictastic/bulk_persistence_strategy.rb,
lib/elastictastic/new_relic_instrumentation.rb,
lib/elastictastic/discrete_persistence_strategy.rb

Defined Under Namespace

Modules: Callbacks, Dirty, Document, MassAssignmentSecurity, Middleware, NestedDocument, NewRelicInstrumentation, Observing, ParentChild, Persistence, Properties, Scoped, ServerError, TestHelpers, Util, Validations Classes: Association, BulkPersistenceStrategy, ChildCollectionProxy, Client, Configuration, DiscretePersistenceStrategy, Field, Index, Railtie, Scope, ScopeBuilder, Search

Constant Summary collapse

CancelBulkOperation =
Class.new(StandardError)
IllegalModificationError =
Class.new(StandardError)
OperationNotAllowed =
Class.new(StandardError)
NoServerAvailable =
Class.new(StandardError)
RecordInvalid =
Class.new(StandardError)
VERSION =
'0.5.0'
Observer =
Class.new(ActiveModel::Observer)
Resource =
NestedDocument

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.config ⇒ Object



39
40
41
# File 'lib/elastictastic.rb', line 39

def config
  @config ||= Configuration.new
end

Class Method Details

.bulk ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/elastictastic.rb', line 56

def bulk
  original_persister = self.persister
  begin
    self.persister = Elastictastic::BulkPersistenceStrategy.new
    yield
    self.persister.flush
  rescue Elastictastic::CancelBulkOperation
    # Nothing to see here...
  ensure
    self.persister = original_persister
  end
end

.client ⇒ Object



43
44
45
# File 'lib/elastictastic.rb', line 43

def client
  Thread.current['Elastictastic::client'] ||= Client.new(config)
end

.Index(name_or_index) ⇒ Object



69
70
71
# File 'lib/elastictastic.rb', line 69

def Index(name_or_index)
  Index === name_or_index ?  name_or_index : Index.new(name_or_index)
end

.persister ⇒ Object



51
52
53
54
# File 'lib/elastictastic.rb', line 51

def persister
  Thread.current['Elastictastic::persister'] ||=
    Elastictastic::DiscretePersistenceStrategy.instance
end

.persister=(persister) ⇒ Object



47
48
49
# File 'lib/elastictastic.rb', line 47

def persister=(persister)
  Thread.current['Elastictastic::persister'] = persister
end