com.lordofthejars.nosqlunit.elasticsearch.parser.DataReader Maven / Gradle / Ivy
package com.lordofthejars.nosqlunit.elasticsearch.parser;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.elasticsearch.action.index.IndexRequestBuilder;
import org.elasticsearch.client.Client;
public class DataReader {
private static final ObjectMapper MAPPER = new ObjectMapper();
public static final String DOCUMENTS_ELEMENT = "documents";
public static final String DOCUMENT_ELEMENT = "document";
public static final String DATA_ELEMENT = "data";
public static final String INDEX_ELEMENT = "index";
public static final String INDEX_NAME_ELEMENT = "indexName";
public static final String INDEX_TYPE_ELEMENT = "indexType";
public static final String INDEX_ID_ELEMENT = "indexId";
private Client client;
public DataReader(Client client) {
this.client = client;
}
public void read(InputStream data) {
try {
List