class Channel(Document): channel_title = Text(analyzer=name_analyzer) channel_desc = Text(analyzer=text_analyzer) all_playlists_titles = Text(analyzer=name_analyzer) all_playlists_desc = Text(analyzer=text_analyzer) all_videos_titles = Text(analyzer=name_analyzer) all_videos_desc = Text(analyzer=text_analyzer) upload_interval = Double() view_count = Long() video_count = Integer() subscriber_count = Long() channel_create_date = Date() latest_upload_datetime = Date() categories = Text(analyzer=name_analyzer) image_url = Keyword() channel_url = Keyword() # override the Document save method to include subclass field definitions def save(self, *args, **kwargs): return super(Channel, self).save(*args, **kwargs)
class PaperFieldsOfStudy(DocType): PaperId = Long(required=True) FieldOfStudyId = Long(required=True) Similarity = Float() class Meta: index = 'PaperFieldsOfStudy'.lower()
class TargetIndex(DocType): targetID = Long() target = Text() annotation = Text(analyzer=ngramAnalyzer) species = Text(analyzer=ngramAnalyzer) status = Keyword() # Text() clone = Keyword() # Text() protein = Keyword() # Text() genePage = Text(analyzer=ngramAnalyzer) uniprot = Text(analyzer=ngramAnalyzer) taxonClass = Text(analyzer=ngramAnalyzer) superkingdom = Keyword() targetRole = Text(analyzer=ngramAnalyzer) batch = Text(analyzer=ngramAnalyzer) community = Text(analyzer=ngramAnalyzer) maxCode = Long() ''' targetID = Long() target = Text() annotation = Text() species = Text() status = Keyword() # Text() clone = Keyword() # Text() protein = Keyword() # Text() genePage = Text() uniprot = Text() taxonClass = Text() superkingdom = Keyword() targetRole = Text() batch = Text() community = Text() maxCode = Long() ''' class Meta: index = "targetstatus-index"
class Position(DocType): # 证券id securityId = Keyword() # 持有数量 amount = Long() # 可交易数量 availableAmount = Long() # 盈亏 profit = Float() # 市值 value = Float() # 成本价 cost = Float() # 交易类型(0代表T+0,1代表T+1) tradingT = Short() def __init__(self, meta=None, security_id=None, trading_t=1, **kwargs): super().__init__(meta, **kwargs) self.securityId = security_id self.availableAmount = 0 self.amount = 0 self.profit = 0 self.value = 0 self.cost = 0 self.tradingT = trading_t
class Features(DocType): """ Database entity for static features.""" pass_name = Keyword() place = Keyword() features_set = Nested( doc_class = FeaturesSet, properties = { 'numIVUsers': Integer(), 'isLoopSimplifyForm': Boolean(), 'isEmpty': Boolean(), 'numIntToFloatCast': Integer(), 'hasLoopPreheader': Boolean(), 'numTermBrBlocks': Integer(), 'latchBlockTermOpcode': Long(), 'numCalls': Integer(), 'notDuplicatable': Boolean(), 'convergent': Boolean(), 'loopSize': Integer(), 'tripCount': Integer(), 'tripMultiply': Long(), 'termByCondBr': Boolean(), 'headerAddressTaken': Boolean(), 'PHINodesInExitBlocks': Boolean() } ) class Meta: index = 'runsystemdb' def save(self, ** kwargs): return super(Features, self).save(** kwargs)
class TaxRulesIndex(DocType): id = Integer() code = Text() priority = Integer() position = Integer() customer_tax_class_ids = Long() product_tax_class_ids = Long() tax_rate_ids = Long() calculate_subtotal = Boolean() rates = Object( properties={ 'id': Integer(), 'tax_country_id': Text(), 'tax_region_id': Integer(), 'tax_postcode': Text(), 'rate': Integer(), 'code': Text(), }) class Index: name = 'vue_storefront_catalog' doc_type = 'taxrule' class Meta: doc_type = "taxrule"
class TwitterEntitiesMedia(InnerDoc): id = Long(doc_values=False, index=False) id_str = Keyword(doc_values=False, index=False) indices = Short(doc_values=False, index=False, multi=True) media_url = Keyword(doc_values=False, index=False) media_url_https = Keyword(doc_values=False, index=False) url = Keyword(doc_values=False, index=False) display_url = Keyword(doc_values=False, index=False) expanded_url = Keyword(doc_values=False, index=False) type = Keyword() original_info = Object(TwitterEntitiesMediaOriginalInfo) sizes = Object(TwitterEntitiesMediaSizes) source_status_id = Long(doc_values=False, index=False) source_status_id_str = Keyword() source_user_id = Long(doc_values=False, index=False) source_user_id_str = Keyword() video_info = Object(TwitterEntitiesMediaVideoInfo) features = Object(TwitterEntitiesMediaFeatures) # {}? media_key = Keyword(doc_values=False, index=False) ext_media_availability = Object(TwitterEntitiesMediaExtMediaAvailability) ext_alt_text = Keyword(doc_values=False, index=False) ext_media_color = Object(TwitterExtensionsMediaColor) ext = Object(TwitterExtensions) additional_media_info = Object(TwitterEntitiesAdditionalMediaInfo)
class PaperAuthorAffiliations(DocType): PaperId = Long(required=True) AuthorId = Long(required=True) AffiliationId = Long() AuthorSequenceNumber = Integer(required=True) OriginalAffiliation = Text() # new attribute ver.2019-01-01 class Meta: index = 'PaperAuthorAffiliations'.lower()
class SubscriptionObj(DocType): id = Long() user_id = Long() page_id = Long() subscription_uuid = Text() created = Date() modified = Date() start = Date() end = Date() status = Text()
class SiMu(Document): id = Text() establishDate = Long() fundName = Text() managerName = Text() mandatorName = Text() putOnRecordDate = Long() class Index: name = 'simu'
class ConferenceSeries(DocType): ConferenceSeriesId = Long(required=True) Rank = Integer(required=True) NormalizedName = Text(required=True, analyzer="standard") DisplayName = Text(required=True, analyzer="standard") PaperCount = Long() CitationCount = Long() CreatedDate = Date(required=True) class Meta: index = 'ConferenceSeries'.lower()
class DstIp(CommonDoc, CommonIp): """ dst ip doc class """ flows = Long() bytes = Long() packets = Long() ip = Keyword() class Meta: index = 'dst-ip-stats-2017.08.02'
class SrcIp(CommonDoc, CommonIp): """ src ip doc class """ flows = Long() bytes = Long() packets = Long() ip = Keyword() class Meta: index = 'src-ip-stats-2017.08.02'
class Authors(DocType): AuthorId = Long(required=True) Rank = Integer(required=True) NormalizedName = Text(required=True, analyzer="standard") DisplayName = Text(required=True, analyzer="standard") LastKnownAffiliationId = Long() PaperCount = Long() CitationCount = Long() CreatedDate = Date(required=True) class Meta: index = 'Authors'.lower() # index name should be lowercase
class Loop(DocType): """Database entity for loop.""" loop_id = Keyword() exec_time = Long() code_size = Long() llc_misses = Long() function_id = Keyword() class Meta: index = 'runsystemdb' def save(self, ** kwargs): return super(Loop, self).save(** kwargs)
class FieldsOfStudy(DocType): FieldOfStudyId = Long(required=True) Rank = Integer(required=True) NormalizedName = Text(required=True, analyzer="standard") DisplayName = Text(required=True, analyzer="standard") MainType = Text(analyzer="standard") Level = Integer(required=True) PaperCount = Long() CitationCount = Long() CreatedDate = Date(required=True) class Meta: index = 'FieldsOfStudy'.lower()
class SlowQuery(Document): finger = Text(fields={'raw': Keyword()}) host = Text(fields={'raw': Keyword()}) lock_time = Float() query_sql = Text(fields={'raw': Keyword()}) query_time = Float() rows_examined = Long() rows_sent = Long() user = Text(fields={'raw': Keyword()}) schema = Text(fields={'raw': Keyword()}) class Index: # 声明使用哪个索引 name = 'mysql-slowsql-test-*'
class AuthorInfo(DocType): # meta.id = hash(NormalizedName) NormalizedName = Text(required=True, analyzer="standard") DisplayName = Text(required=True, analyzer="standard") AuthorIds = Long(multi=True) Papers = Object(multi=True, properties={ "AuthorId": Long(required=True), "PaperIds": Long(multi=True) }) CreatedDate = Date(required=True) class Meta: index = "author_info"
class Journals(DocType): JournalId = Long(required=True) Rank = Integer(required=True) NormalizedName = Text(required=True, analyzer="standard") DisplayName = Text(required=True, analyzer="standard") Issn = Text() Publisher = Text() Webpage = Text() PaperCount = Long() CitationCount = Long() CreatedDate = Date(required=True) class Meta: index = 'Journals'.lower()
class Affiliations(DocType): AffiliationId = Long(required=True) Rank = Integer(required=True) NormalizedName = Text(required=True, analyzer="standard") DisplayName = Text(required=True, analyzer="standard") GridId = Text(required=True) OfficialPage = Text(required=True) WikiPage = Text(required=True) PaperCount = Long() CitationCount = Long() CreatedDate = Date(required=True) class Meta: index = 'Affiliations'.lower()
class Event(InnerDoc): """ Meetup Group Event """ # required fields meetup_id = Text(required=True) time = Date(required=True) name = Text(required=True) link = Text(required=True) date_in_series_pattern = Boolean(required=True) # optional fields attendance_count = Integer() attendance_sample = Integer() attendee_sample = Integer() created = Date() description = Text() duration = Long() fee_accepts = Text() fee_amount = Integer() fee_currency = Text() fee_description = Text() fee_label = Text() how_to_find_us = Text() status = Text() updated = Date() utc_offset = Long() venue_visibility = Text() visibility = Text() # venue venue_address_1 = Text() venue_address_2 = Text() venue_address_3 = Text() venue_city = Text() venue_country = Text() venue_localized_country_name = Text() venue_name = Text() venue_phone = Text() venue_zip_code = Text() venue_location = GeoPoint() # event hosts event_host_host_count = Integer() event_host_id = Integer() event_host_intro = Text() event_host_join_date = Date() event_host_name = Text()
class DigitalFileDoc(BaseDoc): uuid = Text() # To split file extensions, the pattern tokenizer is used, # which defaults to the "\W+" pattern. filepath = Text( fields={'raw': Keyword()}, analyzer=analyzer( 'filepath', tokenizer='pattern', filter=['lowercase'], ), ) fileformat = Text(fields={'raw': Keyword()}) size_bytes = Long() # Always saved as UTC, not just the default. datemodified = Date(default_timezone='UTC') dip = Object( properties={ 'id': Integer(), 'identifier': Text(), 'title': Text(), 'import_status': Keyword(), }) collection = Object( properties={ 'id': Integer(), 'identifier': Text(), 'title': Text(fields={'raw': Keyword()}), }) class Index: name = 'scope_digital_files'
class Session(DocType): """ Session model, on which Products are grouped. id: Session's id. Made by Elasticsearch name: Session's name. UPPERCASE gender: Session's target gender image: Session's image address pos: Session's position to be shown in the list storename: The store's name from which the data was crawled """ gender = Text(fields={"keyword": Keyword()}, required=True) image = Text(fields={"keyword": Keyword()}, required=True) name = Text(fields={"keyword": Keyword()}, required=True) pos = Long(required=True) storename = Text(fields={"keyword": Keyword()}, required=True) class Meta: index = "store" doc_type = "sessions" def get_dict(self) -> dict: return { "id": self.meta["id"], "name": self.name, "gender": self.gender, "image": self.image }
class IndexedFile(DocType): name = Text(fields={ '_exact': Keyword() }) path = Text(fields={ '_exact': Keyword(), '_path': Text(analyzer=path_analyzer), '_path_real': Text(analyzer=path_analyzer) }) lastModified = Date() length = Long() format = String() mimeType = Keyword() type = String() system = String(fields={ '_exact': Keyword() }) systemId = String() dsMeta = Nested() permissions = Nested(properties={ 'username': Keyword(), 'recursive': Boolean(), 'permission': Nested(properties={ 'read': Boolean(), 'write': Boolean(), 'execute': Boolean() }) }) uuid = Keyword() class Meta: index = settings.ES_INDICES['files']['name'] doc_type = settings.ES_INDICES['files']['documents'][0]['name'] dynamic = MetaField('strict')
class DigitalFileDoc(BaseDoc): uuid = Text() # To split file extensions, the pattern tokenizer is used, # which defaults to the "\W+" pattern. filepath = Text( fields={"raw": Keyword()}, analyzer=analyzer("filepath", tokenizer="pattern", filter=["lowercase"]), ) fileformat = Text(fields={"raw": Keyword()}) size_bytes = Long() # Always saved as UTC, not just the default. datemodified = Date(default_timezone="UTC") dip = Object( properties={ "id": Integer(), "identifier": Text(), "title": Text(), "import_status": Keyword(), }) collection = Object( properties={ "id": Integer(), "identifier": Text(), "title": Text(fields={"raw": Keyword()}), }) class Index: name = "scope_digital_files"
class Book(DocType): id = Long() title = Text() description = Text() class Meta: index = 'book'
class Content(DocType): id = Long() context = Text(fields={'with_punctuations': Text(analyzer=my_analyzer)}) class Meta: index = 'test_content'
class Wiki(Document): owner = Object(User) views = Long() ranked = RankFeatures() class Index: name = "test-wiki"
class ResourceIndex(DocType): name = Text() slug = Text() brief_description = Text() show_window = Boolean() visible = Boolean() order = Integer() topic_id = Long() subejct_id = Long() nested_tags = Nested(ResourceTagIndex) create_date = Date() last_update = Date() subclass = Text() class Index: name = 'resource-index'
class RedditLinkMediaOEmbed(InnerDoc): author_name = Keyword() author_url = Keyword() cache_age = Long(doc_values=False, index=False) description = Text( index_options=_INDEX_OPTIONS, index_phrases=_INDEX_PHRASES, term_vector=_INDEX_TERM_VECTOR, analyzer="standard", ) height = Short(doc_values=False, index=False) html = Keyword(doc_values=False, index=False) html5 = Keyword(doc_values=False, index=False) mean_alpha = Float(doc_values=False, index=False) provider_name = Keyword() provider_url = Keyword() thumbnail_height = Short(doc_values=False, index=False) thumbnail_url = Keyword(doc_values=False, index=False) thumbnail_size = Short(doc_values=False, index=False) thumbnail_width = Short(doc_values=False, index=False) title = Text( index_options=_INDEX_OPTIONS, index_phrases=_INDEX_PHRASES, term_vector=_INDEX_TERM_VECTOR, analyzer="standard", ) type = Keyword() version = Keyword() url = Keyword() width = Short(doc_values=False, index=False)