Java Code Examples for org.elasticsearch.common.xcontent.XContentBuilder#rawField()
The following examples show how to use
org.elasticsearch.common.xcontent.XContentBuilder#rawField() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PolicyProcessor.java From oneops with Apache License 2.0 | 5 votes |
private XContentBuilder getQuery(String queryString, CmsCISimple ciSimple) { XContentBuilder docBuilder = null; try { docBuilder = XContentFactory.jsonBuilder().startObject(); docBuilder.field("query").startObject().field("query_string").startObject().field("query", queryString).endObject().endObject(); docBuilder.rawField("ci", GSON_ES.toJson(ciSimple).getBytes()); docBuilder.endObject(); logger.info(docBuilder.string()); } catch (IOException e) { logger.error("Error in forming percolator query ", e); } return docBuilder; }
Example 2
Source File: Template.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Override protected XContentBuilder scriptFieldToXContent(String template, ScriptType type, XContentBuilder builder, Params builderParams) throws IOException { if (type == ScriptType.INLINE && contentType != null && builder.contentType() == contentType) { builder.rawField(type.getParseField().getPreferredName(), new BytesArray(template)); } else { builder.field(type.getParseField().getPreferredName(), template); } return builder; }
Example 3
Source File: AggregationBuilder.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Override public final XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(getName()); if (this.metaData != null) { builder.field("meta", this.metaData); } builder.field(type); internalXContent(builder, params); if (aggregations != null || aggregationsBinary != null) { if (aggregations != null) { builder.startObject("aggregations"); for (AbstractAggregationBuilder subAgg : aggregations) { subAgg.toXContent(builder, params); } builder.endObject(); } if (aggregationsBinary != null) { if (XContentFactory.xContentType(aggregationsBinary) == builder.contentType()) { builder.rawField("aggregations", aggregationsBinary); } else { builder.field("aggregations_binary", aggregationsBinary); } } } return builder.endObject(); }
Example 4
Source File: CompletionSuggestion.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Override protected XContentBuilder innerToXContent(XContentBuilder builder, Params params) throws IOException { super.innerToXContent(builder, params); if (payload != null && payload.length() > 0) { builder.rawField("payload", payload); } return builder; }
Example 5
Source File: GetFieldMappingsResponse.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.field("full_name", fullName); if (params.paramAsBoolean("pretty", false)) { builder.field("mapping", sourceAsMap()); } else { builder.rawField("mapping", source); } return builder; }
Example 6
Source File: RenderSearchTemplateResponse.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(); builder.rawField("template_output", source); builder.endObject(); return builder; }
Example 7
Source File: QuerySourceBuilder.java From Elasticsearch with Apache License 2.0 | 5 votes |
public void innerToXContent(XContentBuilder builder, Params params) throws IOException { if (queryBuilder != null) { builder.field("query"); queryBuilder.toXContent(builder, params); } if (queryBinary != null) { if (XContentFactory.xContentType(queryBinary) == builder.contentType()) { builder.rawField("query", queryBinary); } else { builder.field("query_binary", queryBinary); } } }
Example 8
Source File: PercolateSourceBuilder.java From Elasticsearch with Apache License 2.0 | 4 votes |
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { return builder.rawField("doc", doc); }