Module Import alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias alias alias ImportFrom alias ImportFrom alias alias alias ImportFrom alias ImportFrom alias ImportFrom alias alias ImportFrom alias Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Dict FunctionDef arguments args NameParam defaults NameLoad body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr orelse Assign NameStore ListComp SubscriptLoad NameLoad Index NameLoad comprehension NameStore NameLoad Expr Call AttributeLoad NameLoad attr keyword Lambda arguments args NameParam defaults Call AttributeLoad NameLoad attr Return NameLoad decorator_list Assign NameStore Call NameLoad FunctionDef arguments args defaults body Expr Str If CompareIs Call NameLoad NameLoad Str NameLoad NameLoad body Assign AttributeStore NameLoad attr Call NameLoad Return AttributeLoad NameLoad attr decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults body Expr Str Raise NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad Call NameLoad attr TupleLoad AttributeLoad NameLoad attr TupleLoad Call AttributeLoad NameLoad attr TupleLoad AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad Call NameLoad attr TupleLoad AttributeLoad NameLoad attr TupleLoad Call AttributeLoad NameLoad attr TupleLoad AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases NameLoad NameLoad body Expr Str Assign NameStore ListLoad FunctionDef arguments args NameParam defaults body Return Call AttributeLoad NameLoad attr NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Return Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam defaults body Return Str decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Raise NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Return ListLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Return Call AttributeLoad Call AttributeLoad AttributeLoad Call AttributeLoad NameLoad attr attr attr Str attr Str keyword NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore AttributeLoad NameLoad attr Return ListComp Call NameLoad GeneratorExp TupleLoad NameLoad IfExp CompareIn NameLoad NameLoad NameLoad SubscriptLoad NameLoad Index Num comprehension TupleStore NameStore NameStore Call AttributeLoad NameLoad attr comprehension NameStore NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults vararg kwarg body If UnaryOpNot AttributeLoad NameLoad attr body Return Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults vararg kwarg body If UnaryOpNot AttributeLoad NameLoad attr body Return TryExcept body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad handlers ExceptHandler type NameLoad body Pass decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Return Call NameLoad Call NameLoad NameLoad NameLoad NameLoad keyword Num keyword Num decorator_list NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad If BoolOpAnd CompareIsNot NameLoad NameLoad UnaryOpNot NameLoad body Expr Call Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults kwarg body Expr Str Expr Call NameLoad NameLoad Call AttributeLoad NameLoad attr Str Str decorator_list FunctionDef arguments args NameParam NameParam defaults kwarg body Expr Str Expr Call NameLoad NameLoad Call AttributeLoad NameLoad attr Str Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Return Call NameLoad NameLoad keyword NameLoad keyword BinOpMod Str TupleLoad NameLoad AttributeLoad NameLoad attr NameLoad keyword NameLoad decorator_list If NameLoad body Expr Call Call NameLoad NameLoad Str NameLoad orelse Expr Call Call NameLoad NameLoad Str NameLoad Expr Call Call NameLoad NameLoad Str IfExp CompareIs NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign SubscriptStore NameLoad Index Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args defaults kwarg body Expr Str Assign NameStore Call NameLoad For TupleStore NameStore NameStore NameLoad body Expr Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr decorator_list Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad ClassDef bases AttributeLoad NameLoad attr body FunctionDef arguments args NameParam defaults body Expr Str Return Call AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases NameLoad body Expr Str Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore TupleLoad TupleLoad NameLoad Str TupleLoad NameLoad Str TupleLoad NameLoad Str TupleLoad NameLoad Str Assign NameStore ListLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr keyword Num Assign NameStore Call AttributeLoad NameLoad attr keyword Num Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr keyword Num keyword NameLoad Assign NameStore Call NameLoad ClassDef bases body Assign NameStore ListLoad Str Assign NameStore TupleLoad TupleLoad Str Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str If BoolOpAnd AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Return BinOpSub AttributeLoad NameLoad attr AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Str body Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr SubscriptLoad NameLoad Slice Num Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults Str body Expr Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr SubscriptLoad NameLoad Slice Num Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Return BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases NameLoad body Expr Str Assign NameStore Call AttributeLoad NameLoad attr keyword Num Assign NameStore Call AttributeLoad NameLoad attr keyword Num FunctionDef arguments args NameParam defaults body Return Call AttributeLoad Str attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list decorator_list
N/A N/A datetime N/A logging threading local django.conf settings django.core signals django.db models django.db.models.signals pre_delete post_save m2m_changed django.dispatch receiver elasticutils.contrib.django MappingType Indexable MLT elasticsearch.exceptions NotFoundError kitsune.search es_utils kitsune.search.tasks index_task unindex_task kitsune.sumo.models ModelBase N/A log N/A N/A logging getLogger k.search.es N/A _search_mapping_types N/A get_mapping_types N/A N/A mapping_types N/A None N/A N/A Returns a list of MappingTypes N/A N/A mapping_types None N/A N/A values N/A N/A _search_mapping_types values N/A N/A values N/A N/A _search_mapping_types N/A name N/A name mapping_types N/A N/A N/A values sort key N/A N/A N/A cls N/A N/A N/A cls get_mapping_type_name N/A values N/A N/A _local N/A local _local_tasks N/A N/A N/A N/A N/A (Create and) return the threadlocal set of indexing tasks. N/A N/A N/A getattr _local tasks None None N/A N/A N/A _local tasks N/A set N/A N/A _local tasks N/A SearchMixin N/A object N/A N/A A mixin which adds ES indexing support for the model

    When using this mixin, make sure to implement:

    * get_mapping_type

    Additionally, after defining your model, remember to register it and any
    related models which affect it::

         register_for_indexing(MyModel, 'some_app')
         register_for_indexing(RelatedModel, 'some_app',
                                instance_to_indexee=lambda r: r.my_model)

     get_mapping_type N/A N/A cls N/A N/A N/A Return the MappingType for this model N/A NotImplementedError N/A classmethod index_later N/A N/A self N/A N/A N/A Register myself to be indexed at the end of the request. N/A N/A N/A N/A _local_tasks add N/A N/A index_task delay N/A N/A N/A self get_mapping_type N/A N/A self pk N/A unindex_later N/A N/A self N/A N/A N/A Register myself to be unindexed at the end of the request. N/A N/A N/A N/A _local_tasks add N/A N/A unindex_task delay N/A N/A N/A self get_mapping_type N/A N/A self pk N/A N/A SearchMappingType N/A MappingType Indexable N/A N/A Contains helpers on top of what ElasticUtils provides

    Subclasses should implement the following:

    1. get_mapping needs to return {'properties': { ... fields ... }}
    2. get_query_fields should return a list of fields for query
    3. extract_document
    4. get_model
    5. the mapping type class should be decorated with
       ``@register_mapping_type``

    Then make sure to:

    6. implement get_mapping_type on the related model

     N/A list_keys N/A search N/A N/A cls N/A N/A N/A N/A N/A es_utils Sphilastic cls N/A classmethod get_index N/A N/A cls N/A N/A N/A N/A N/A es_utils write_index N/A N/A cls get_index_group N/A classmethod get_index_group N/A N/A cls N/A N/A N/A default N/A classmethod get_query_fields N/A N/A cls N/A N/A N/A Return the list of fields for query N/A NotImplementedError N/A classmethod get_localized_fields N/A N/A cls N/A N/A N/A N/A N/A classmethod get_indexable N/A N/A cls N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A cls get_model objects order_by pk values_list pk flat True N/A classmethod reshape N/A N/A cls results N/A N/A N/A Reshapes the results so lists are lists and everything is not N/A list_keys N/A cls list_keys N/A N/A N/A dict N/A N/A key N/A N/A key list_keys val N/A val N/A 0 N/A N/A key val N/A N/A result items N/A result results N/A classmethod index N/A N/A cls N/A args kwargs N/A N/A N/A N/A settings ES_LIVE_INDEXING N/A N/A N/A N/A N/A N/A super SearchMappingType cls index args kwargs N/A classmethod unindex N/A N/A cls N/A args kwargs N/A N/A N/A N/A settings ES_LIVE_INDEXING N/A N/A N/A N/A N/A N/A N/A N/A super SearchMappingType cls unindex args kwargs N/A N/A N/A NotFoundError N/A N/A N/A classmethod morelikethis N/A N/A cls id_ s fields N/A N/A N/A MoreLikeThis API N/A N/A list N/A MLT id_ s fields min_term_freq 1 min_doc_freq 1 N/A classmethod N/A _identity N/A N/A s N/A N/A N/A s N/A register_for_indexing N/A N/A app sender_class instance_to_indexee m2m N/A _identity False N/A N/A Registers a model for signal-based live-indexing.

    As data changes in the database, we need to update the relevant
    documents in the index. This function registers Django model
    classes with the appropriate signals and update/delete routines
    such that our index stays up-to-date.

    :arg app: A bit of UID we use to build the signal handlers'
        dispatch_uids.  This is prepended to the ``sender_class``
        model name, "elastic", and the signal name, so it should
        combine with those to make something unique. For this reason,
        the app name is usually a good choice, yielding something like
        "wiki.TaggedItem.elastic.post_save".
    :arg sender_class: The class to listen for saves and deletes on.
    :arg instance_to_indexee: A callable which takes the signalling
        instance and returns the model instance to be indexed. The
        returned instance should be a subclass of SearchMixin. If the
        callable returns None, no indexing is performed.

        Default: a callable which returns the sender itself.
    :arg m2m: True if this is a m2m model and False otherwise.

    Examples::

        # Registers MyModel for indexing. post_save creates new
        # documents in the index. pre_delete removes documents
        # from the index.
        register_for_indexing(MyModel, 'some_app')

        # Registers RelatedModel for indexing. RelatedModel is related
        # to some model in the sense that the document in the index is
        # composed of data from some model and it's related
        # RelatedModel instance. Because of that when we update
        # RelatedModel instances, we need to update the associated
        # document in the index for the related model.
        #
        # This registers the RelatedModel for indexing. post_save and
        # pre_delete update the associated document in the index for
        # the related model. The related model instance is determined
        # by the instance_to_indexee function.
        register_for_indexing(RelatedModel, 'some_app',
                              instance_to_indexee=lambda r: r.my_model)


     maybe_call_method N/A N/A instance is_raw method_name N/A N/A N/A Call an (un-)indexing method on instance if appropriate. N/A obj N/A instance_to_indexee instance N/A N/A N/A obj None N/A is_raw N/A N/A N/A N/A getattr obj method_name N/A update N/A N/A sender instance N/A kw N/A N/A File an add-to-index task for the indicated object. N/A N/A maybe_call_method instance N/A N/A kw get raw index_later N/A delete N/A N/A sender instance N/A kw N/A N/A File a remove-from-index task for the indicated object. N/A N/A maybe_call_method instance N/A N/A kw get raw unindex_later N/A indexing_receiver N/A N/A signal signal_name N/A N/A N/A Return a routine that registers signal handlers for indexers.

        The returned registration routine uses strong refs, makes up a
        dispatch_uid, and uses ``sender_class`` as the sender.

         N/A N/A receiver signal sender sender_class dispatch_uid N/A %s.%s.elastic.%s N/A app N/A sender_class __name__ signal_name weak False N/A N/A m2m N/A N/A N/A N/A indexing_receiver m2m_changed m2m_changed update N/A N/A N/A N/A indexing_receiver post_save post_save update N/A N/A N/A indexing_receiver pre_delete pre_delete N/A N/A instance_to_indexee _identity delete update N/A register_mapping_type N/A N/A cls N/A N/A N/A Class decorator for registering MappingTypes for search N/A N/A _search_mapping_types N/A N/A N/A cls get_mapping_type_name cls N/A cls N/A generate_tasks N/A N/A N/A kwargs N/A N/A Goes through thread local index update tasks set and generates
    celery tasks for all tasks in the set.

    Because this works off of a set, it naturally de-dupes the tasks,
    so if four tasks get tossed into the set that are identical, we
    execute it only once.

     N/A tasks N/A _local_tasks N/A N/A fun args tasks N/A N/A N/A fun args N/A N/A N/A tasks clear N/A N/A N/A N/A N/A signals request_finished connect generate_tasks RecordManager N/A N/A models Manager N/A outstanding N/A N/A self N/A N/A N/A Return outstanding records N/A N/A N/A self filter status__in N/A Record STATUS_OUTSTANDING N/A N/A Record N/A ModelBase N/A N/A Indexing record. N/A STATUS_NEW 0 N/A STATUS_IN_PROGRESS 1 N/A STATUS_FAIL 2 N/A STATUS_SUCCESS 3 N/A STATUS_CHOICES N/A N/A STATUS_NEW new N/A STATUS_IN_PROGRESS in progress N/A STATUS_FAIL done - fail N/A STATUS_SUCCESS done - success N/A STATUS_OUTSTANDING N/A STATUS_NEW STATUS_IN_PROGRESS N/A batch_id N/A N/A models CharField max_length 10 N/A name N/A N/A models CharField max_length 255 N/A creation_time N/A N/A models DateTimeField auto_now_add True N/A start_time N/A N/A models DateTimeField null True N/A end_time N/A N/A models DateTimeField null True N/A status N/A N/A models IntegerField choices STATUS_CHOICES default STATUS_NEW N/A message N/A N/A models CharField max_length 255 blank True N/A objects N/A RecordManager Meta N/A N/A N/A ordering N/A -start_time N/A permissions N/A N/A reindex Can run a full reindexing N/A delta N/A N/A self N/A N/A N/A Return the timedelta. N/A N/A N/A self start_time N/A self end_time N/A N/A N/A N/A self end_time N/A self start_time N/A None N/A _complete N/A N/A self status msg N/A Done N/A N/A N/A self end_time N/A N/A N/A datetime datetime now N/A N/A self status status N/A N/A self message msg N/A mark_fail N/A N/A self msg N/A N/A N/A Mark as failed.

        :arg msg: the error message it failed with

         N/A N/A N/A self _complete N/A self STATUS_FAIL N/A msg N/A 255 N/A N/A N/A self save N/A mark_success N/A N/A self msg N/A Success N/A N/A Mark as succeeded.

        :arg msg: success message if any

         N/A N/A N/A self _complete N/A self STATUS_SUCCESS N/A msg N/A 255 N/A N/A N/A self save N/A __unicode__ N/A N/A self N/A N/A N/A N/A %s:%s%s N/A N/A self batch_id N/A self name N/A self status N/A N/A Synonym N/A ModelBase N/A N/A To be serialized into ES for synonyms. N/A from_words N/A N/A models CharField max_length 1024 N/A to_words N/A N/A models CharField max_length 1024 __unicode__ N/A N/A self N/A N/A N/A N/A N/A {0} => {1} format N/A self from_words N/A self to_words N/A N/A