i am trying to create an index from Java code to index some data but if i am creating index pattern with time filter Kibana never shows any data. Following below order while creating index with some setting and adding an index template for date filed
CreateIndexRequest request = new CreateIndexRequest(indexName);
request.settings(Settings.builder()
.put("index.max_inner_result_window", 250)
.put("index.write.wait_for_active_shards", 1)
.put("index.query.default_field", "paragraph")
.put("index.number_of_shards", 3)
.put("index.number_of_replicas", 2)
.loadFromSource(Strings.toString(
XContentFactory.jsonBuilder()
.startObject()
.startObject("analysis")
.startObject("analyzer")
.startObject("englishAnalyzer")
.field("tokenizer", "standard")
.field("char_filter", "html_strip")
.field("filter", new String[] { "snowball", "standard", "lowercase" })
.endObject()
.startObject("email")
.field("filter", new String[] { "standard", "lowercase" })
.field("type", "custom")
.field("tokenizer", "uax_url_email")
.endObject()
.endObject()
.endObject()
.endObject()), XContentType.JSON));
CreateIndexResponse createIndexResponse = client.indices().create(request, RequestOptions.DEFAULT);
PutIndexTemplateRequest request = new PutIndexTemplateRequest(templateName);
request.patterns(templateList);
request.settings(Settings.builder().put("index.number_of_shards", 3).put("index.number_of_replicas", 1));
XContentBuilder builder = XContentFactory.jsonBuilder();
builder.startObject();
{
builder.startObject("properties");
{
builder.startObject("createdDate");
{
builder.field("type", "date").field("format", "yyyy-MM-dd HH:mm:ss.SSS");
}
builder.endObject();
}
builder.endObject();
}
builder.endObject();
request.mapping(builder);
request.version();
client.indices().putTemplate(request, RequestOptions.DEFAULT);
Then i am inserting below record as JSON but when creating an index pattern with time filter keep on showing empty result in Kibana discovery
{
"createdDate": "2020-11-25 13:33:36.782",
"userId": "raw.man@bee.com",
}