If you don't store the source, then you need to explicitly store specific fields (and ask for them in the search request) if you want them. It usually makes sense to use the _source field then storing specific fields separately.
On Saturday, June 4, 2011 at 5:55 PM, slavag wrote:
Hi,
I'm trying to disable _source field, using this:
XContentBuilder data = jsonBuilder().startObject()
.startObject("type")
.startObject("_source")
.field("enabled", false)
.endObject()
.endObject()
.endObject();client.admin().indices().ccreate(new
CreateIndexRequest("index").mapping("type", data ));
And looks like _source is indeed not stored.Then I'm doing index with:
XContentBuilder jsonBuilder = XContentFactory.jsonBuilder();
jsonBuilder.startObject();
jsonBuilder.field(FROMFIELD,addr.toString());
jsonBuilder.field(RECIPIENTFIELD,addr.toString());
jsonBuilder.field(SUBJECTFIELD,message.getSubject());
jsonBuilder.field("bckdate",backuptimstamp);
jsonBuilder.endObject();IndexRequestBuilder indexRequest =
client.prepareIndex(this.tenant,this.type,id).setSource(jsonBuilder);
IndexResponse response = indexRequest.execute().actionGet();The search result returns hits, without source field but as well
without any other field , even on search I'm adding those fields.Looks like schema is not updated, the question after such a manual
mapping, should schema be updated on index with new fields ?Thank You and Best Regards.