You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
893 B
37 lines
893 B
from elasticsearch_dsl import DocType, Date, Nested, Boolean, \
|
|
analyzer, InnerObjectWrapper, Completion, Keyword, Text, Object
|
|
|
|
from elasticsearch_dsl.connections import connections
|
|
|
|
connections.create_connection(hosts=["localhost"])
|
|
|
|
class TextBook(InnerObjectWrapper):
|
|
pass
|
|
|
|
class Section(InnerObjectWrapper):
|
|
pass
|
|
|
|
class Course(DocType):
|
|
textbook = Object(
|
|
doc_class=TextBook,
|
|
properties = {
|
|
"author" : Text(),
|
|
"title" : Text(),
|
|
"price" : Text()
|
|
}
|
|
)
|
|
|
|
sections = Object(
|
|
doc_class=Section,
|
|
properties = {
|
|
"sem" : Keyword(),
|
|
"title" : Text(),
|
|
"prof" : Text(),
|
|
"loc" : Text(),
|
|
"time" : Text(),
|
|
"day" : Text()
|
|
}
|
|
)
|
|
|
|
class Meta:
|
|
index = "course_test"
|
|
|