forked from pdonorio/restapi-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathelasticsearch.py
More file actions
58 lines (37 loc) · 1.08 KB
/
elasticsearch.py
File metadata and controls
58 lines (37 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# -*- coding: utf-8 -*-
""" Custom models for elastic search """
# from __future__ import absolute_import
# from ..logs import get_logger
from elasticsearch_dsl import DocType, String, Completion
# from elasticsearch_dsl import analyzer, tokenizer
# my_analyzer = analyzer(
# 'my_analyzer',
# tokenizer=tokenizer('trigram', 'nGram', min_gram=2, max_gram=3),
# filter=['lowercase']
# )
# logger = get_logger(__name__)
# logger.info("Things to do")
class GenericDocument(DocType):
key = String()
value = String()
class Meta:
index = 'generic'
class GenericSuggestion(DocType):
suggestme = Completion(payloads=True)
class Meta:
index = 'suggestion'
class FedappCatalog(DocType):
name = String()
format = String()
owner = String()
locations = String() # this is a list
metadata = String() # this is a list
tags = String() # this is a list
# metadata = Nested(
# doc_class=Metadata,
# properties={
# 'key': String()
# }
# )
class Meta:
index = 'generic'