Kibana index pattern don't show data with time filter field name

血红的双手。 提交于 2021-02-11 14:21:58

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!