本文整理汇总了Java中org.elasticsearch.ElasticsearchIllegalArgumentException类的典型用法代码示例。如果您正苦于以下问题:Java ElasticsearchIllegalArgumentException类的具体用法?Java ElasticsearchIllegalArgumentException怎么用?Java ElasticsearchIllegalArgumentException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ElasticsearchIllegalArgumentException类属于org.elasticsearch包,在下文中一共展示了ElasticsearchIllegalArgumentException类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: mongoDB
import org.elasticsearch.ElasticsearchIllegalArgumentException; //导入依赖的package包/类
public synchronized DB mongoDB(String host, int port, String databaseName, String username, String password) {
if (mongoDB != null) {
return mongoDB;
}
try {
MongoClient client = new MongoClient(host, port);
mongoDB = client.getDB(databaseName);
if (username != null && password != null){
mongoDB.authenticate(username, password.toCharArray());
}
return mongoDB;
} catch (UnknownHostException e) {
throw new ElasticsearchIllegalArgumentException("Unknown host", e);
}
}
开发者ID:kzwang,项目名称:elasticsearch-repository-gridfs,代码行数:17,代码来源:GridFsService.java
示例2: parse
import org.elasticsearch.ElasticsearchIllegalArgumentException; //导入依赖的package包/类
public PrefixSuggestionContext parse(XContentParser parser, MapperService mapperService) throws IOException {
XContentParser.Token token;
String fieldName = null;
PrefixSuggestionContext suggestion = new PrefixSuggestionContext(suggester);
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
if (token == XContentParser.Token.FIELD_NAME) {
fieldName = parser.currentName();
} else if (token.isValue()) {
parseTokenValue(parser, mapperService, fieldName, suggestion);
} else {
throw new ElasticsearchIllegalArgumentException("suggester[term] doesn't support field [" + fieldName + "]");
}
}
return suggestion;
}
开发者ID:meltwater,项目名称:es-prefix-suggester,代码行数:16,代码来源:PrefixContextParser.java
示例3: parseTokenValue
import org.elasticsearch.ElasticsearchIllegalArgumentException; //导入依赖的package包/类
private void parseTokenValue(XContentParser parser, MapperService mapperService, String fieldName, PrefixSuggestionContext suggestion) throws IOException {
if (MIN_PREFIX_LENGTH_FIELD.equals(fieldName)) {
suggestion.setMinPrefixLength(parser.intValue());
} else if (!(SuggestUtils.parseSuggestContext(parser, mapperService, fieldName, suggestion))) {
throw new ElasticsearchIllegalArgumentException("suggester[term] doesn't support [" + fieldName + "]");
}
}
开发者ID:meltwater,项目名称:es-prefix-suggester,代码行数:10,代码来源:PrefixContextParser.java
示例4: forName
import org.elasticsearch.ElasticsearchIllegalArgumentException; //导入依赖的package包/类
public static GeoJsonGeoShapeType forName(String geoshapename) {
String typename = geoshapename.toLowerCase(Locale.ROOT);
for (GeoJsonGeoShapeType type : values()) {
if(type.shapename.equals(typename)) {
return type;
}
}
throw new ElasticsearchIllegalArgumentException("unknown geo_shape ["+geoshapename+"]");
}
开发者ID:opendatasoft,项目名称:elasticsearch-aggregation-envelope,代码行数:10,代码来源:InternalConvexHull.java
示例5: parseTypes
import org.elasticsearch.ElasticsearchIllegalArgumentException; //导入依赖的package包/类
private byte[] parseTypes(List<String> rules) {
SortedMap<Character, Byte> typeMap = newTreeMap();
for (String rule : rules) {
Matcher m = typePattern.matcher(rule);
if (!m.find()) {
throw new ElasticsearchIllegalArgumentException("invalid rule : [" + rule + "]");
}
String lhs = parseString(m.group(1).trim());
Byte rhs = parseType(m.group(2).trim());
if (lhs.length() != 1) {
throw new ElasticsearchIllegalArgumentException("invalid rule : [" + rule + "]: only single character allowed");
}
if (rhs == null) {
throw new ElasticsearchIllegalArgumentException("invalid rule : [" + rule + "]: type illegal");
}
typeMap.put(lhs.charAt(0), rhs);
}
// ensure the table is always at least as big as DEFAULT_WORD_DELIM_TABLE for performance
byte types[] = new byte[Math.max(typeMap.lastKey() + 1, WordDelimiterIterator.DEFAULT_WORD_DELIM_TABLE.length)];
for (int i = 0; i < types.length; i++) {
types[i] = WordDelimiterIterator.getType(i);
}
for (Map.Entry<Character, Byte> mapping : typeMap.entrySet()) {
types[mapping.getKey()] = mapping.getValue();
}
return types;
}
开发者ID:jprante,项目名称:elasticsearch-analysis-german,代码行数:29,代码来源:WordDelimiterFilterFactory.java
示例6: createDictionary
import org.elasticsearch.ElasticsearchIllegalArgumentException; //导入依赖的package包/类
private Dictionary createDictionary(Environment env, Settings settings) {
try {
String lang = settings.get("language", "de");
String path = "/baseform/" + lang + "-lemma-utf8.txt";
return new Dictionary().load(new InputStreamReader(env.resolveConfig(path).openStream(), "UTF-8"));
} catch (IOException e) {
throw new ElasticsearchIllegalArgumentException("resources in settings not found: " + settings, e);
}
}
开发者ID:jprante,项目名称:elasticsearch-analysis-german,代码行数:10,代码来源:BaseformTokenFilterFactory.java
示例7: fromId
import org.elasticsearch.ElasticsearchIllegalArgumentException; //导入依赖的package包/类
public static State fromId(byte id) throws ElasticsearchIllegalArgumentException {
if (id < 0 || id >= STATES.length) {
throw new ElasticsearchIllegalArgumentException("No mapping for id [" + id + "]");
}
return STATES[id];
}
开发者ID:codelibs,项目名称:elasticsearch-benchmark-suite,代码行数:7,代码来源:BenchmarkResponse.java
示例8: parseString
import org.elasticsearch.ElasticsearchIllegalArgumentException; //导入依赖的package包/类
private String parseString(String s) {
int readPos = 0;
int len = s.length();
int writePos = 0;
while (readPos < len) {
char c = s.charAt(readPos++);
if (c == '\\') {
if (readPos >= len) {
throw new ElasticsearchIllegalArgumentException("invalid escaped char in [" + s + "]");
}
c = s.charAt(readPos++);
switch (c) {
case '\\':
c = '\\';
break;
case 'n':
c = '\n';
break;
case 't':
c = '\t';
break;
case 'r':
c = '\r';
break;
case 'b':
c = '\b';
break;
case 'f':
c = '\f';
break;
case 'u':
if (readPos + 3 >= len) {
throw new ElasticsearchIllegalArgumentException("invalid escaped char in [" + s + "]");
}
c = (char) Integer.parseInt(s.substring(readPos, readPos + 4), 16);
readPos += 4;
break;
}
}
out[writePos++] = c;
}
return new String(out, 0, writePos);
}
开发者ID:jprante,项目名称:elasticsearch-analysis-german,代码行数:44,代码来源:WordDelimiterFilterFactory.java
注:本文中的org.elasticsearch.ElasticsearchIllegalArgumentException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论