<commit_before>"""
    Elasticsearch Document Object Model
"""
import os

# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import
from elasticsearch_dsl import *


# parse environment variables
ES_HOST = os.getenv('ES_HOST', 'localhost:9200')
ES_INDEX_NAME = 'smartapi_docs'

# create a default connection
connections.create_connection(hosts=ES_HOST)


class UserMeta(InnerDoc):
    """ The _meta field. """
    url = Keyword(required=True)
    slug = Keyword()  # url shortcut
    username = Keyword(required=True)
    date_created = Date(default_timezone='UTC')
    last_updated = Date(default_timezone='UTC')


class StatMeta(InnerDoc):
    """ The _status field. """

    uptime_status = Keyword()
    uptime_msg = Text()
    uptime_ts = Date()

    refresh_status = Integer()
    refresh_ts = Date()


class APIDoc(Document):

    _meta = Object(UserMeta, required=True)
    _status = Object(StatMeta)
    _raw = Binary()

    info = Object()
    servers = Object()
    paths = Object(
        properties={
            "path": Text(),<commit_msg>uptime msg not searchable<commit_after>"""
    Elasticsearch Document Object Model
"""
import os

# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import
from elasticsearch_dsl import *


# parse environment variables
ES_HOST = os.getenv('ES_HOST', 'localhost:9200')
ES_INDEX_NAME = 'smartapi_docs'

# create a default connection
connections.create_connection(hosts=ES_HOST)


class UserMeta(InnerDoc):
    """ The _meta field. """
    url = Keyword(required=True)
    slug = Keyword()  # url shortcut
    username = Keyword(required=True)
    date_created = Date(default_timezone='UTC')
    last_updated = Date(default_timezone='UTC')


class StatMeta(InnerDoc):
    """ The _status field. """

    uptime_status = Keyword()
    uptime_msg = Text(index=False)
    uptime_ts = Date()

    refresh_status = Integer()
    refresh_ts = Date()


class APIDoc(Document):

    _meta = Object(UserMeta, required=True)
    _status = Object(StatMeta)
    _raw = Binary()

    info = Object()
    servers = Object()
    paths = Object(
        properties={
            "path": Text(),
{'fraction_non_alphanumeric': 0.11789181692094314, 'fraction_numerical': 0.0036985668053629217, 'mean_word_length': 3.8088888888888888, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1943250', 'n_tokens_mistral': 706, 'n_tokens_neox': 669, 'n_words': 156}