List of (object_types, friendly name) present in the index.
18799
def searchable_object_types(self):
        """"""
        try:
            idx = self.index()
        except KeyError:
            # index does not exists: service never started, may happens during
            # tests
            return []

        with idx.reader() as r:
            indexed = sorted(set(r.field_terms("object_type")))
        app_indexed = self.app_state.indexed_fqcn

        return [(name, friendly_fqcn(name)) for name in indexed if name in app_indexed]
911441
def _clean_index(self):
        ""
        for idx_name, idx_def in self.index_defs.items():
            if idx_def['type'] == 'lazy':
                self.build_index(idx_name)
        for index_name, values in self.indexes.items():
            for value in values:
                if not isinstance(values[value], set):
                    values[value] = set(values[value])
1212711
def get_objects_without_object(self, obj_type, *child_types):
        
        return [o for o in self.get_objects_by_type(obj_type) if
                not o.get_objects_by_type(*child_types)]
633246
def determine_types(self):
        
        from nefertari.elasticsearch import ES
        collections = self.get_collections()
        resources = self.get_resources(collections)
        models = set([res.view.Model for res in resources])
        es_models = [mdl for mdl in models if mdl
                     and getattr(mdl, '_index_enabled', False)]
        types = [ES.src2type(mdl.__name__) for mdl in es_models]
        return types
264671
def get_type(self, index):

        
        if index < 0 or index >= len(self._types):
            raise ValueError("Index for getting order parameter type"
                             " out-of-bounds!")
        return self._types[index]
648477
def simpleAttrs(self):
        """"""
        simpleAttrs = {}
        for k,v in iteritems(self.attrs):
            if k in ["_matches"]: continue # attributes to specifically ignore
            try:    simpleAttrs[k] = v.type
            except: simpleAttrs[k] = v
        return simpleAttrs
353514
def list_types(index_name, host='localhost',port='9200'):
        '''
        
        '''
        return ElasticSearch(host=host, port=port).type_list(index_name)
884564
def _index_classes(self) -> Dict[Text, Type[Platform]]:
        

        out = {}

        for p in get_platform_settings():
            cls: Type[Platform] = import_class(p['class'])

            if 'name' in p:
                out[p['name']] = cls
            else:
                out[cls.NAME] = cls

        return out
802014
def _index_and_mapping(self, namespace):
        """"""
        index, doc_type = namespace.split(".", 1)
        return index.lower(), doc_type
1311947
def get_model_index_properties(instance, index):
    """"""
    mapping = get_index_mapping(index)
    doc_type = instance._meta.model_name.lower()
    return list(mapping["mappings"][doc_type]["properties"].keys())
1141088
def itemtypes(cls, mapped_types, coll_type, visitor):
        
        rv = list(v for k, v in mapped_types)
        return rv[0] if len(rv) == 1 else rv
1272505
def types(cls, **kwargs):
    """"""
    named = {name: factory(Arguments._fields.index(name), name)
             for name, factory in six.iteritems(kwargs)}
    return cls(**named)
1052158
def package_org_types(self, obj_list):
        
        org_type_list = []
        for obj in obj_list:
            sane_obj = convert_ms_object(
                obj['Fields']['KeyValueOfstringanyType']
            )
            org = OrganizationType(sane_obj)
            org_type_list.append(org)
        return org_type_list
459315
def types(self):
        
        output = set()
        for var in self.values():
            if var.has_value():
                output.update(var.types())
        return list(output)
201303
def _index(self, model):
        '''
        
        '''
        doc_type = model
        if not isinstance(model, str):
            doc_type = model.__table__.name

        index_name = doc_type
        if hasattr(model, "__msearch_index__"):
            index_name = model.__msearch_index__

        if doc_type not in self._indexs:
            self._indexs[doc_type] = Index(self._client, index_name, doc_type)
        return self._indexs[doc_type]
1371761
def build_index(self, idx_name, _type='default'):
        ""
        indexes = {}
        has_non_string_values = False
        for key, item in self.data.items():
            if idx_name in item:
                value = item[idx_name]
                # A non-string index value switches it into a lazy one.
                if not isinstance(value, six.string_types):
                    has_non_string_values = True
                if value not in indexes:
                    indexes[value] = set([])
                indexes[value].add(key)
        self.indexes[idx_name] = indexes
        if self._meta.lazy_indexes or has_non_string_values:
            # Every index is lazy
            _type = 'lazy'
        self.index_defs[idx_name] = {'type': _type}
1066939
def _descriptor_names(self):
        

        descriptor_names = []

        for name in dir(self):
            try:
                attr = getattr(type(self), name)

                if isinstance(attr, DJANGO_RELATED_FIELD_DESCRIPTOR_CLASSES):
                    descriptor_names.append(name)

            except AttributeError:
                pass

        return descriptor_names