mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-05 20:48:22 +00:00
Ids with # in them will cause search failures, also, fail when # is used in a type name, closes #728.
This commit is contained in:
parent
3bac33e69e
commit
906ec57f20
@ -148,7 +148,10 @@ public class MapperService extends AbstractIndexComponent implements Iterable<Do
|
||||
private void add(DocumentMapper mapper) {
|
||||
synchronized (mutex) {
|
||||
if (mapper.type().charAt(0) == '_') {
|
||||
throw new InvalidTypeNameException("Document mapping type name can't start with '_'");
|
||||
throw new InvalidTypeNameException("mapping type name [" + mapper.type() + "] can't start with '_'");
|
||||
}
|
||||
if (mapper.type().contains("#")) {
|
||||
throw new InvalidTypeNameException("mapping type name [" + mapper.type() + "] should not include '#' in it");
|
||||
}
|
||||
remove(mapper.type()); // first remove it (in case its an update, we need to remove the aggregated mappers)
|
||||
mappers = newMapBuilder(mappers).put(mapper.type(), mapper).immutableMap();
|
||||
|
@ -66,7 +66,7 @@ public final class Uid {
|
||||
}
|
||||
|
||||
public static Uid createUid(String uid) {
|
||||
int delimiterIndex = uid.lastIndexOf(DELIMITER);
|
||||
int delimiterIndex = uid.indexOf(DELIMITER); // type is not allowed to have # in it..., ids can
|
||||
return new Uid(uid.substring(0, delimiterIndex), uid.substring(delimiterIndex + 1));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user