from django.db import models

# Create your models here.

__author__ = 'Von'

from elasticsearch_dsl import DocType, Date, Completion, Keyword, Text

from elasticsearch_dsl.connections import connections
connections.create_connection(hosts=["192.168.1.106"])
# config/.yml --> network --> ip

from elasticsearch_dsl.analysis import CustomAnalyzer as _CustomAnalyzer
class CustomAnalyzer(_CustomAnalyzer):
    def get_analysis_definition(self):
        return {}
ikAnalyzer = CustomAnalyzer("ik_max_word", filter=["lowercase"])

class tgbusType(DocType):
    # 为type创建mapping
    suggestion = Completion(analyzer=ikAnalyzer)
    title = Text(analyzer="ik_max_word")
    author = Keyword()
    keywords = Keyword()
    abstract = Text()
    pubTime = Date()
    content = Text(analyzer="ik_max_word")
    url = Keyword()

    class Meta:
        index = "tgbus"
        doc_type = "article"

# 根据type生成mapping
if __name__ == "__main__":
    tgbusType.init()
87b261b22f32a81dd1ba94279afa5b4ee21b0677
<mask token>


class CustomAnalyzer(_CustomAnalyzer):

    def get_analysis_definition(self):
        return {}


<mask token>


class tgbusType(DocType):
    suggestion = Completion(analyzer=ikAnalyzer)
    title = Text(analyzer='ik_max_word')
    author = Keyword()
    keywords = Keyword()
    abstract = Text()
    pubTime = Date()
    content = Text(analyzer='ik_max_word')
    url = Keyword()


    class Meta:
        index = 'tgbus'
        doc_type = 'article'


<mask token>

<mask token>
connections.create_connection(hosts=['192.168.1.106'])
<mask token>


class CustomAnalyzer(_CustomAnalyzer):

    def get_analysis_definition(self):
        return {}


<mask token>


class tgbusType(DocType):
    suggestion = Completion(analyzer=ikAnalyzer)
    title = Text(analyzer='ik_max_word')
    author = Keyword()
    keywords = Keyword()
    abstract = Text()
    pubTime = Date()
    content = Text(analyzer='ik_max_word')
    url = Keyword()


    class Meta:
        index = 'tgbus'
        doc_type = 'article'


if __name__ == '__main__':
    tgbusType.init()

<mask token>
__author__ = 'Von'
<mask token>
connections.create_connection(hosts=['192.168.1.106'])
<mask token>


class CustomAnalyzer(_CustomAnalyzer):

    def get_analysis_definition(self):
        return {}


ikAnalyzer = CustomAnalyzer('ik_max_word', filter=['lowercase'])


class tgbusType(DocType):
    suggestion = Completion(analyzer=ikAnalyzer)
    title = Text(analyzer='ik_max_word')
    author = Keyword()
    keywords = Keyword()
    abstract = Text()
    pubTime = Date()
    content = Text(analyzer='ik_max_word')
    url = Keyword()


    class Meta:
        index = 'tgbus'
        doc_type = 'article'


if __name__ == '__main__':
    tgbusType.init()

from django.db import models
__author__ = 'Von'
from elasticsearch_dsl import DocType, Date, Completion, Keyword, Text
from elasticsearch_dsl.connections import connections
connections.create_connection(hosts=['192.168.1.106'])
from elasticsearch_dsl.analysis import CustomAnalyzer as _CustomAnalyzer


class CustomAnalyzer(_CustomAnalyzer):

    def get_analysis_definition(self):
        return {}


ikAnalyzer = CustomAnalyzer('ik_max_word', filter=['lowercase'])


class tgbusType(DocType):
    suggestion = Completion(analyzer=ikAnalyzer)
    title = Text(analyzer='ik_max_word')
    author = Keyword()
    keywords = Keyword()
    abstract = Text()
    pubTime = Date()
    content = Text(analyzer='ik_max_word')
    url = Keyword()


    class Meta:
        index = 'tgbus'
        doc_type = 'article'


if __name__ == '__main__':
    tgbusType.init()

from django.db import models

# Create your models here.

__author__ = 'Von'

from elasticsearch_dsl import DocType, Date, Completion, Keyword, Text

from elasticsearch_dsl.connections import connections
connections.create_connection(hosts=["192.168.1.106"])
# config/.yml --> network --> ip

from elasticsearch_dsl.analysis import CustomAnalyzer as _CustomAnalyzer
class CustomAnalyzer(_CustomAnalyzer):
    def get_analysis_definition(self):
        return {}
ikAnalyzer = CustomAnalyzer("ik_max_word", filter=["lowercase"])

class tgbusType(DocType):
    # 为type创建mapping
    suggestion = Completion(analyzer=ikAnalyzer)
    title = Text(analyzer="ik_max_word")
    author = Keyword()
    keywords = Keyword()
    abstract = Text()
    pubTime = Date()
    content = Text(analyzer="ik_max_word")
    url = Keyword()

    class Meta:
        index = "tgbus"
        doc_type = "article"

# 根据type生成mapping
if __name__ == "__main__":
    tgbusType.init()