问题
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);
Prior to insert first record creating below template.
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",
}
Don't understand what is wrong with my code. I am using ELK 7.4
if i select "i don't want use time filter" then i can see the data in kibana
来源:https://stackoverflow.com/questions/65005817/kibana-index-pattern-dont-show-data-with-time-filter-field-name