Hi,
I wanted to disable storing _source field and also to not make one of
the fields not analyzable, this is the code:
Client client = node.client();
XContentBuilder data = jsonBuilder().startObject()
.startObject("properties")
.startObject("bdate")
.field("type", "string")
.field("index", "not_analyzed")
.field("store", "yes")
.endObject()
.startObject("_source")
.field("enabled", false)
.endObject()
.endObject()
.endObject();
client.admin().indices().create(new
CreateIndexRequest("test").mapping("cont", data));
IndexResponse indexRes = client.prepareIndex("test", "cont", "1")
.setSource(jsonBuilder()
.startObject()
.field("Name", "Test")
.field("BirthDate", new Date())
.field("Email", "test@test.com")
.field("bdate", "1234567890")
.endObject()
).execute()
.actionGet();
But, when I'm doing search - I still get the _source field , but on
the other hand - the not_analyzable field is indeed not participating
in
the search.
What could be my mistake here ?
Thank You and Best Regards.