File tree 3 files changed +22
-2
lines changed
3 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ class MyDoc(document.Document):
18
18
created_at = field .Date ()
19
19
inner = field .Object (MyInner )
20
20
21
+ class Index :
22
+ name = 'my-doc'
23
+
21
24
class MySubDoc (MyDoc ):
22
25
name = field .Keyword ()
23
26
@@ -118,6 +121,10 @@ class D(document.Document):
118
121
kw = field .Keyword ()
119
122
class Meta :
120
123
doc_type = 'not-doc'
124
+
125
+ class Index :
126
+ name = 'test-not-doc-index'
127
+
121
128
assert D ._index ._get_doc_type () == 'not-doc'
122
129
assert D ._index .to_dict () == {
123
130
'mappings' : {'not-doc' : {'properties' : {'kw' : {'type' : 'keyword' }}}}
@@ -126,7 +133,8 @@ class Meta:
126
133
def test_document_cannot_specify_different_doc_type_if_index_defined ():
127
134
# this will initiate ._index with doc_type = 'doc'
128
135
class C (document .Document ):
129
- pass
136
+ class Index :
137
+ name = 'test-doc-type-c'
130
138
131
139
with raises (IllegalOperation ):
132
140
class D (C ):
@@ -619,7 +627,8 @@ def test_from_es_respects_underscored_non_meta_fields():
619
627
}
620
628
621
629
class Company (document .Document ):
622
- pass
630
+ class Index :
631
+ name = 'test-company'
623
632
624
633
c = Company .from_es (doc )
625
634
Original file line number Diff line number Diff line change @@ -21,10 +21,17 @@ class Repos(Document):
21
21
is_public = Boolean ()
22
22
created_at = Date ()
23
23
24
+ class Index :
25
+ name = 'git'
26
+
27
+
24
28
class Commit (Document ):
25
29
files = Keyword ()
26
30
committed_date = Date ()
27
31
32
+ class Index :
33
+ name = 'git'
34
+
28
35
class RepoSearch (FacetedSearch ):
29
36
index = 'git'
30
37
doc_types = [Repos ]
Original file line number Diff line number Diff line change @@ -151,6 +151,10 @@ def test_bucket_response_can_be_iterated_over(agg_response):
151
151
def test_bucket_keys_get_deserialized (aggs_data , aggs_search ):
152
152
class Commit (Document ):
153
153
info = Object (properties = {'committed_date' : Date ()})
154
+
155
+ class Index :
156
+ name = 'test-commit'
157
+
154
158
aggs_search = aggs_search .doc_type (Commit )
155
159
agg_response = response .Response (aggs_search , aggs_data )
156
160
You can’t perform that action at this time.
0 commit comments