// Path: src/main/java/com/presidentio/testdatagenerator/output/formatter/EsFormatter.java
// public class EsFormatter implements Formatter {
// 
//     private static final String INDEX = "{ \"index\" : { \"_index\" : \"%s\", \"_type\" : \"%s\"} }";
// 
//     private ObjectMapper objectMapper = new ObjectMapper();
// 
//     private String index;
// 
//     @Override
//     public void init(Map<String, String> props) {
//         index = props.get(PropConst.INDEX);
//         if (index == null) {
//             throw new IllegalArgumentException(PropConst.INDEX + " does not specified or null");
//         }
// 
//     }
// 
//     @Override
//     public String format(Map<String, Object> map, Template template) {
//         String result = String.format(INDEX, index, template.getName());
//         result += DelimiterConst.NEW_LINE;
//         try {
//             result += objectMapper.writeValueAsString(map);
//             result += DelimiterConst.NEW_LINE;
//         } catch (IOException e) {
//             throw new IllegalArgumentException(e);
//         }
//         return result;
//     }
// 
//     @Override
//     public String format(List<Map<String, Object>> maps, Template template) {
//         StringBuilder stringBuilder = new StringBuilder();
//         for (Map<String, Object> map : maps) {
//             stringBuilder.append(format(map, template));
//         }
//         return stringBuilder.toString();
//     }
// 
//     @Override
//     public boolean supportMultiInsert() {
//         return true;
//     }
// }
// 
// Path: src/main/java/com/presidentio/testdatagenerator/output/formatter/Formatter.java
// public interface Formatter {
// 
//     void init(Map<String, String> props);
// 
//     String format(Map<String, Object> map, Template template);
// 
//     String format(List<Map<String, Object>> maps, Template template);
//     
//     boolean supportMultiInsert();
// 
// }


import com.presidentio.testdatagenerator.output.formatter.Formatter;
import java.util.Map;
import com.presidentio.testdatagenerator.output.formatter.EsFormatter;
/**
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.presidentio.testdatagenerator.output;



public class EsDirectSink extends AbstractEsSink {

    @Override
    public void init(Map<String, String> props) {
        super.init(props);
// Path: src/main/java/com/presidentio/testdatagenerator/output/formatter/EsFormatter.java
// public class EsFormatter implements Formatter {
// 
//     private static final String INDEX = "{ \"index\" : { \"_index\" : \"%s\", \"_type\" : \"%s\"} }";
// 
//     private ObjectMapper objectMapper = new ObjectMapper();
// 
//     private String index;
// 
//     @Override
//     public void init(Map<String, String> props) {
//         index = props.get(PropConst.INDEX);
//         if (index == null) {
//             throw new IllegalArgumentException(PropConst.INDEX + " does not specified or null");
//         }
// 
//     }
// 
//     @Override
//     public String format(Map<String, Object> map, Template template) {
//         String result = String.format(INDEX, index, template.getName());
//         result += DelimiterConst.NEW_LINE;
//         try {
//             result += objectMapper.writeValueAsString(map);
//             result += DelimiterConst.NEW_LINE;
//         } catch (IOException e) {
//             throw new IllegalArgumentException(e);
//         }
//         return result;
//     }
// 
//     @Override
//     public String format(List<Map<String, Object>> maps, Template template) {
//         StringBuilder stringBuilder = new StringBuilder();
//         for (Map<String, Object> map : maps) {
//             stringBuilder.append(format(map, template));
//         }
//         return stringBuilder.toString();
//     }
// 
//     @Override
//     public boolean supportMultiInsert() {
//         return true;
//     }
// }
// 
// Path: src/main/java/com/presidentio/testdatagenerator/output/formatter/Formatter.java
// public interface Formatter {
// 
//     void init(Map<String, String> props);
// 
//     String format(Map<String, Object> map, Template template);
// 
//     String format(List<Map<String, Object>> maps, Template template);
//     
//     boolean supportMultiInsert();
// 
// }


// Path: src/main/java/com/presidentio/testdatagenerator/output/EsDirectSink.java
import com.presidentio.testdatagenerator.output.formatter.Formatter;
import java.util.Map;
import com.presidentio.testdatagenerator.output.formatter.EsFormatter;

/**
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.presidentio.testdatagenerator.output;



public class EsDirectSink extends AbstractEsSink {

    @Override
    public void init(Map<String, String> props) {
        super.init(props);
        Formatter formatter = new EsFormatter();