SourceFieldMapper sourceFieldMapper = context.mapperService().documentMapper(hitContext.hit().getType()).sourceMapper(); if (!sourceFieldMapper.enabled()) { throw new IllegalArgumentException("source is forced for fields " + fieldNamesToHighlight
public BytesReference source(IndexService indexService, DocumentMapper docMapper, Map sourceAsMap, Uid uid) throws JsonParseException, JsonMappingException, IOException { if (docMapper.sourceMapper().enabled()) { // retreive from _source columns stored as blob in cassandra if available. ByteBuffer bb = (ByteBuffer) sourceAsMap.get(SourceFieldMapper.NAME); if (bb != null) return new BytesArray(bb.array(), bb.position(), bb.limit() - bb.position()); } // rebuild _source from all cassandra columns. XContentBuilder builder = buildDocument(docMapper, sourceAsMap, true, isStaticDocument(indexService, uid)); builder.humanReadable(true); return builder.bytes(); }
if (docMapper.sourceMapper().enabled()) columns.add(SourceFieldMapper.NAME); if (mappingMap.get("properties") != null)
/** * Validate the pay load of the search-into context. * @param context */ protected void validate(SearchIntoContext context) { if (context.hasFieldNames() && context.fieldNames().contains("_source")) { String index = context.mapperService().index().getName(); for (String type : context.mapperService().types()) { if (!context.mapperService().documentMapper(type).sourceMapper().enabled()) { throw new SearchParseException(context, "The _source field of index " + index + " and type " + type + " is not stored."); } } } } }
protected boolean shouldGetFromSource(boolean ignoreErrorsOnGeneratedFields, DocumentMapper docMapper, FieldMapper fieldMapper) { if (!fieldMapper.isGenerated()) { //if the field is always there we check if either source mapper is enabled, in which case we get the field // from source, or, if the field is stored, in which case we have to get if from source here also (we are in the translog phase, doc not indexed yet, we annot access the stored fields) return docMapper.sourceMapper().enabled() || fieldMapper.fieldType().stored(); } else { if (!fieldMapper.fieldType().stored()) { //if it is not stored, user will not get the generated field back return false; } else { if (ignoreErrorsOnGeneratedFields) { return false; } else { throw new ElasticsearchException("Cannot access field " + fieldMapper.name() + " from transaction log. You can only get this field after refresh() has been called."); } } } }
columns.add(TTLFieldMapper.NAME); if (docMapper.sourceMapper().enabled()) { columns.add(SourceFieldMapper.NAME); SourceFieldMapper sourceFieldMapper = docMapper.sourceMapper();
SourceFieldMapper sourceFieldMapper = context.mapperService().documentMapper(hitContext.hit().type()).sourceMapper(); if (!sourceFieldMapper.enabled()) { throw new IllegalArgumentException("source is forced for fields " + fieldNamesToHighlight
SourceFieldMapper sourceFieldMapper = context.mapperService().documentMapper(hitContext.hit().getType()).sourceMapper(); if (!sourceFieldMapper.enabled()) { throw new IllegalArgumentException("source is forced for fields " + fieldNamesToHighlight
if (docMapper.sourceMapper().enabled()) { sourceMap.put(SourceFieldMapper.NAME, request.source());
SourceFieldMapper sourceFieldMapper = context.mapperService().documentMapper(hitContext.hit().getType()).sourceMapper(); if (!sourceFieldMapper.enabled()) { throw new IllegalArgumentException("source is forced for fields " + fieldNamesToHighlight
SourceFieldMapper sourceFieldMapper = docMapper.sourceMapper(); if (fetchSourceContext.fetchSource() && sourceFieldMapper.enabled()) {
SourceFieldMapper sourceFieldMapper = context.mapperService().documentMapper(hitContext.hit().type()).sourceMapper(); if (!sourceFieldMapper.enabled()) { throw new IllegalArgumentException("source is forced for fields " + fieldNamesToHighlight + " but type [" + hitContext.hit().type() + "] has disabled _source");
if (fieldVisitor.loadSource() && docMapper.sourceMapper().enabled()) { requiredColumns.add(SourceFieldMapper.NAME);