@@ -0,0 +1,2212 @@
+package edu.neu.ccs.pyramid.application;%0A%0Aimport edu.neu.ccs.pyramid.configuration.Config;%0Aimport edu.neu.ccs.pyramid.elasticsearch.ESIndex;%0A%0Aimport java.util.List;%0Aimport java.util.regex.Pattern;%0Aimport java.util.stream.Collectors;%0Aimport java.util.stream.IntStream;%0A%0A/**%0A * Created by chengli on 2/10/15.%0A */%0Apublic class IndexChecker %7B%0A    public static void main(String%5B%5D args) throws Exception%7B%0A        if (args.length !=1)%7B%0A            throw new IllegalArgumentException(%22please specify the config file%22);%0A        %7D%0A%0A        Config config = new Config(args%5B0%5D);%0A        System.out.println(config);%0A%0A%0A        ESIndex index = loadIndex(config);%0A        check(config,index);%0A        index.close();%0A%0A%0A    %7D%0A%0A    private static void check(Config config, ESIndex index)%7B%0A        String field = config.getString(%22fieldToCheck%22);%0A        List%3CString%3E ids = IntStream.range(0,index.getNumDocs()).parallel()%0A                .mapToObj(i-%3E %22%22+i)%0A                .filter(id -%3E index.getField(id,field)==null)%0A                .collect(Collectors.toList());%0A        if (ids.size()==0)%7B%0A            System.out.println(%22all documents have the field %22+field);%0A        %7D else %7B%0A            System.out.println(%22the following documents miss the field %22+field);%0A            System.out.println(ids);%0A        %7D%0A%0A%0A    %7D%0A%0A    static ESIndex loadIndex(Config config) throws Exception%7B%0A        ESIndex.Builder builder = new ESIndex.Builder()%0A                .setIndexName(config.getString(%22index.indexName%22))%0A                .setClusterName(config.getString(%22index.clusterName%22))%0A                .setClientType(config.getString(%22index.clientType%22))%0A                .setDocumentType(config.getString(%22index.documentType%22));%0A        if (config.getString(%22index.clientType%22).equals(%22transport%22))%7B%0A            String%5B%5D hosts = config.getString(%22index.hosts%22).split(Pattern.quote(%22,%22));%0A            String%5B%5D ports = config.getString(%22index.ports%22).split(Pattern.quote(%22,%22));%0A            builder.addHostsAndPorts(hosts,ports);%0A        %7D%0A        ESIndex index = builder.build();%0A        System.out.println(%22index loaded%22);%0A        System.out.println(%22there are %22+index.getNumDocs()+%22 documents in the index.%22);%0A        return index;%0A    %7D%0A%7D%0A

add class IndexChecker