File tree Expand file tree Collapse file tree 3 files changed +16
-37
lines changed
modules/elasticsearch/src/main/java/org/elasticsearch Expand file tree Collapse file tree 3 files changed +16
-37
lines changed Original file line number Diff line number Diff line change 32
32
import org .elasticsearch .common .lucene .Lucene ;
33
33
import org .elasticsearch .common .lucene .uid .UidField ;
34
34
import org .elasticsearch .common .settings .Settings ;
35
+ import org .elasticsearch .index .Index ;
35
36
import org .elasticsearch .index .engine .Engine ;
36
- import org .elasticsearch .index .mapper .*;
37
+ import org .elasticsearch .index .mapper .DocumentMapper ;
38
+ import org .elasticsearch .index .mapper .FieldMapper ;
39
+ import org .elasticsearch .index .mapper .FieldMappers ;
40
+ import org .elasticsearch .index .mapper .FieldMappersFieldSelector ;
37
41
import org .elasticsearch .index .service .IndexService ;
38
42
import org .elasticsearch .index .shard .service .IndexShard ;
39
43
import org .elasticsearch .indices .IndicesService ;
44
+ import org .elasticsearch .indices .TypeMissingException ;
40
45
import org .elasticsearch .threadpool .ThreadPool ;
41
46
import org .elasticsearch .transport .TransportService ;
42
47
@@ -79,7 +84,7 @@ public class TransportGetAction extends TransportShardSingleOperationAction<GetR
79
84
80
85
DocumentMapper docMapper = indexService .mapperService ().documentMapper (request .type ());
81
86
if (docMapper == null ) {
82
- throw new DocumentMapperNotFoundException ( "No mapper found for type [" + request .type () + "]" );
87
+ throw new TypeMissingException ( new Index ( request . index ()), request .type ());
83
88
}
84
89
85
90
if (request .refresh ()) {
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 41
41
import org .elasticsearch .index .mapper .xcontent .XContentDocumentMapperParser ;
42
42
import org .elasticsearch .index .settings .IndexSettings ;
43
43
import org .elasticsearch .indices .InvalidTypeNameException ;
44
+ import org .elasticsearch .indices .TypeMissingException ;
44
45
45
46
import javax .annotation .Nullable ;
46
47
import java .io .File ;
@@ -237,10 +238,17 @@ public DocumentMapper documentMapperWithAutoCreate(String type) {
237
238
*/
238
239
public Filter typesFilter (String ... types ) {
239
240
if (types .length == 1 ) {
240
- return documentMapper (types [0 ]).typeFilter ();
241
+ DocumentMapper docMapper = documentMapper (types [0 ]);
242
+ if (docMapper == null ) {
243
+ throw new TypeMissingException (index , types [0 ]);
244
+ }
245
+ return docMapper .typeFilter ();
241
246
}
242
247
PublicTermsFilter termsFilter = new PublicTermsFilter ();
243
248
for (String type : types ) {
249
+ if (!hasMapping (type )) {
250
+ throw new TypeMissingException (index , type );
251
+ }
244
252
termsFilter .addTerm (new Term (TypeFieldMapper .NAME , type ));
245
253
}
246
254
return termsFilter ;
You can’t perform that action at this time.
0 commit comments