本文整理了Java中org.elasticsearch.hadoop.serialization.Generator.writeFieldName()
方法的一些代码示例,展示了Generator.writeFieldName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Generator.writeFieldName()
方法的具体详情如下:
包路径:org.elasticsearch.hadoop.serialization.Generator
类名称:Generator
方法名:writeFieldName
暂无
代码示例来源:origin: elastic/elasticsearch-hadoop
private void writeNullable(Generator generator, String key, String value) {
if (value != null) {
generator.writeFieldName(key).writeString(value);
}
}
}
代码示例来源:origin: elastic/elasticsearch-hadoop
@Override
public void toJson(Generator out) {
if (field == null) {
throw new IllegalArgumentException("inner clause [field] cannot be null");
}
if (term == null) {
throw new IllegalArgumentException("inner clause [term] cannot be null");
}
out.writeFieldName("term")
.writeBeginObject()
.writeFieldName(field)
.writeString(term)
.writeEndObject();
}
代码示例来源:origin: elastic/elasticsearch-hadoop
@Override
public void toJson(Generator out) {
out.writeFieldName("match_all")
.writeBeginObject().writeEndObject();
}
}
代码示例来源:origin: elastic/elasticsearch-hadoop
throw new IllegalArgumentException("inner clause [query] cannot be null");
out.writeFieldName("query_string");
out.writeBeginObject();
out.writeFieldName("query");
out.writeString(query);
if (defaultField != null) {
out.writeFieldName("default_field");
out.writeString(defaultField);
out.writeFieldName("analyzer");
out.writeString(analyzer);
out.writeFieldName("lowercaseExpandedTerms");
out.writeBoolean(lowercaseExpandedTerms);
out.writeFieldName("analyzeWildcard");
out.writeBoolean(analyzeWildcard);
out.writeFieldName("defaultOperator");
out.writeString(defaultOperator);
out.writeFieldName("lenient");
out.writeBoolean(lenient);
代码示例来源:origin: elastic/elasticsearch-hadoop
@Override
public void toJson(Generator out) {
if (filter == null) {
throw new IllegalArgumentException("inner clause [filter] cannot be null.");
}
out.writeFieldName("constant_score");
out.writeBeginObject();
out.writeFieldName("filter");
out.writeBeginObject();
filter.toJson(out);
out.writeEndObject();
out.writeFieldName("boost");
out.writeNumber(boost);
out.writeEndObject();
}
}
代码示例来源:origin: elastic/elasticsearch-hadoop
@Override
public void toJson(Generator out) {
if (query == null) {
throw new IllegalArgumentException("inner clause [query] cannot be null.");
}
out.writeFieldName("filtered");
out.writeBeginObject();
out.writeFieldName("query");
out.writeBeginObject();
query.toJson(out);
out.writeEndObject();
if (filters.isEmpty() == false) {
out.writeFieldName("filter");
out.writeBeginObject();
if (filters.size() == 1) {
filters.get(0).toJson(out);
} else {
BoolQueryBuilder inner = new BoolQueryBuilder();
for (QueryBuilder filter : filters) {
inner.must(filter);
}
inner.toJson(out);
}
out.writeEndObject();
}
out.writeEndObject();
}
代码示例来源:origin: elastic/elasticsearch-hadoop
@Override
public void toJson(Generator out) {
out.writeFieldName("bool");
out.writeBeginObject();
if (mustClauses.size() > 0) {
out.writeFieldName("must");
out.writeBeginArray();
for (QueryBuilder innerQuery : mustClauses) {
out.writeFieldName("should");
out.writeBeginArray();
for (QueryBuilder innerQuery : shouldClauses) {
out.writeFieldName("filter");
out.writeBeginArray();
for (QueryBuilder innerQuery : filterClauses) {
out.writeFieldName("must_not");
out.writeBeginArray();
for (QueryBuilder innerQuery : mustNotClauses) {
代码示例来源:origin: elastic/elasticsearch-hadoop
generator.writeFieldName(fieldName);
Result result = doWrite(entry.getValue(), generator, fieldName);
if (!result.isSuccesful()) {
代码示例来源:origin: elastic/elasticsearch-hadoop
@SuppressWarnings("unchecked")
@Override
public Result write(SinkCall<Object[], ?> sinkCall, Generator generator) {
Tuple tuple = CascadingUtils.coerceToString(sinkCall);
// consider names (in case of aliases these are already applied)
List<String> names = (List<String>) sinkCall.getContext()[SINK_CTX_ALIASES];
generator.writeBeginObject();
for (int i = 0; i < tuple.size(); i++) {
String name = (i < names.size() ? names.get(i) : "tuple" + i);
// filter out fields
if (shouldKeep(generator.getParentPath(), name)) {
generator.writeFieldName(name);
Object object = tuple.getObject(i);
Result result = jdkWriter.write(object, generator);
if (!result.isSuccesful()) {
if (object instanceof Writable) {
return writableWriter.write((Writable) object, generator);
}
return Result.FAILED(object);
}
}
}
generator.writeEndObject();
return Result.SUCCESFUL();
}
代码示例来源:origin: elastic/elasticsearch-hadoop
protected Result doWrite(Tuple tuple, Generator generator, String parentField) {
Fields fields = tuple.getFields();
generator.writeBeginObject();
for (String field : fields) {
if (shouldKeep(parentField, field)) {
generator.writeFieldName(field);
Object value = tuple.getValueByField(field);
if (value instanceof Tuple) {
Result result = write((Tuple) value, generator);
if (!result.isSuccesful()) {
return result;
}
}
else {
Result result = jdkWriter.write(value, generator);
if (!result.isSuccesful()) {
return result;
}
}
}
}
generator.writeEndObject();
return Result.SUCCESFUL();
}
}
代码示例来源:origin: elastic/elasticsearch-hadoop
String fieldName = entry.getKey().toString();
if (shouldKeep(generator.getParentPath(), fieldName)) {
generator.writeFieldName(fieldName);
Result result = write(entry.getValue(), generator);
代码示例来源:origin: elastic/elasticsearch-hadoop
generator.writeFieldName(actualFieldName);
Result result = write(entry.getValue(), moi.getMapValueObjectInspector(), generator);
if (!result.isSuccesful()) {
String actualFieldName = alias.toES(structField.getFieldName());
if (shouldKeep(generator.getParentPath(), actualFieldName)) {
generator.writeFieldName(actualFieldName);
Result result = write(soi.getStructFieldData(data, structField),
structField.getFieldObjectInspector(), generator);
代码示例来源:origin: elastic/elasticsearch-hadoop
String fieldName = entry.getKey().toString();
if (shouldKeep(generator.getParentPath(), fieldName)) {
generator.writeFieldName(alias.toES(fieldName));
Result result = write(entry.getValue(), valueType, generator);
if (!result.isSuccesful()) {
代码示例来源:origin: elastic/elasticsearch-hadoop
String actualName = (fieldHasName ? alias.toES(name) : Integer.toString(i));
if (shouldKeep(generator.getParentPath(), actualName)) {
generator.writeFieldName(actualName);
Result res = write(tuples.get(i), nestedFields[i], generator);
if (!res.isSuccesful()) {
代码示例来源:origin: elastic/elasticsearch-hadoop
public static String printQueryBuilder(QueryBuilder builder, boolean addQuery) {
FastByteArrayOutputStream out = new FastByteArrayOutputStream(256);
Generator generator = new JacksonJsonGenerator(out);
if (addQuery) {
generator.writeBeginObject().writeFieldName("query");
}
generator.writeBeginObject();
builder.toJson(generator);
generator.writeEndObject();
if (addQuery) {
generator.writeEndObject();
}
generator.close();
return out.toString();
}
}
代码示例来源:origin: elastic/elasticsearch-hadoop
generator.writeFieldName("test");
assertEquals("", generator.getParentPath());
generator.writeFieldName("subfield");
assertEquals("test", generator.getParentPath());
generator.writeFieldName("subsubfield");
assertEquals("test.subfield", generator.getParentPath());
代码示例来源:origin: elastic/elasticsearch-hadoop
break;
case FIELD_NAME:
generator.writeFieldName(parser.currentName());
parser.nextToken();
traverse(parser, generator);
代码示例来源:origin: org.elasticsearch/elasticsearch-spark-13
private void writeNullable(Generator generator, String key, String value) {
if (value != null) {
generator.writeFieldName(key).writeString(value);
}
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch-hadoop-mr
@Override
public void toJson(Generator out) {
out.writeFieldName("match_all")
.writeBeginObject().writeEndObject();
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch-spark-13
@Override
public void toJson(Generator out) {
out.writeFieldName("match_all")
.writeBeginObject().writeEndObject();
}
}
内容来源于网络,如有侵权,请联系作者删除!