ElasticSearch Java Client缺少文档

时间:2016-02-21 17:34:01

标签: java elasticsearch

我在我的Java应用程序上设置了elasticsearch客户端,我使用了for循环并试图将文档插入到我的索引中,每个for循环将执行100k次,当时我有4个for循环,我试过了代码上的运行和调试模式,但是当使用matchAllQuery执行搜索API时,我的总命中数的结果不是400k,我一次添加更多搜索请求但是所有回复都少于400k计数。是什么导致我的文档插入失败?

编辑1: 我已经将搜索大小设置为400k

编辑2: 这是我的for循环示例和搜索API示例

for(int i = 0; i < 100000; i++){
                client.prepareIndex("fb", "post", String.valueOf(i)).setTimeout(new TimeValue(6000))
                .setSource(jsonBuilder()
                            .startObject()
                                .field("content", "freeze on the intake of foreign workers including the "
                                        + "1.5 million from Bangladesh has been met with scepticism by kuala lumpur"
                                        + "a Bangladesh official, the Dhaka Tribune reported quoted the acting secretary of Bangladesh")
                            .endObject()
                          ).execute();
            }


for(int i = 100000; i < 200000; i++){
                client.prepareIndex("fb", "post", String.valueOf(i)).setTimeout(new TimeValue(6000))
                .setSource(jsonBuilder()
                            .startObject()
                                .field("content", "freeze on the intake of foreign workers including the "
                                        + "1.5 million from Bangladesh has been met with scepticism by kuala lumpur"
                                        + "a Bangladesh official, the Dhaka Tribune reported quoted the acting secretary of Bangladesh")
                            .endObject()
                          ).execute();
            }

SearchResponse response3 = client.prepareSearch("fb")
                    .setTypes("post")
                    .setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
                    .setScroll(new TimeValue(120000))
                    .setQuery(QueryBuilders.matchQuery("content", "kuala"))
                    .setSize(400000)
                    .execute()
                    .actionGet();

所有这些都返回相同的计数

0 个答案:

没有答案