@SuppressWarnings("unchecked") private <T> T parseContent(InputStream content, String string) { Map<String, Object> map = Collections.emptyMap(); try { // create parser manually to lower Jackson requirements JsonParser jsonParser = mapper.getJsonFactory().createJsonParser(content); try { map = mapper.readValue(jsonParser, Map.class); } finally { countStreamStats(content); } } catch (IOException ex) { throw new EsHadoopParsingException(ex); } return (T) (string != null ? map.get(string) : map); }
if (count != null) { if (!"eq".equals(relation)) { throw new EsHadoopParsingException("Count operation returned non-exact count of [" + relation + "][" + count + "]");
protected Object readListItem(String fieldName, Token t, String fieldMapping, Parser parser) { if (t == Token.START_ARRAY) { return list(fieldName, fieldMapping, parser); } // handle nested nodes first else if (t == Token.START_OBJECT) { // Don't need special handling for nested fields since this field is already in an array. return map(fieldMapping, parser); } FieldType esType = mapping(fieldMapping, parser); if (t.isValue()) { String rawValue = parser.text(); try { return parseValue(parser, esType); } catch (Exception ex) { throw new EsHadoopParsingException(String.format(Locale.ROOT, "Cannot parse value [%s] for field [%s]", rawValue, fieldName), ex); } } return null; }
throw new EsHadoopParsingException("Could not discern relative value of total hits. Response missing [relation] field."); } else if (!"eq".equals(relation)) { throw new EsHadoopParsingException( String.format("Could not discern exact hit count for search response. Received [%s][%s]", relation, throw new EsHadoopParsingException("Could not locate total number of hits for search result.");
@SuppressWarnings("rawtypes") Iterator<Map> parseBulkActionResponse(Response response) { InputStream content = response.body(); // Check for failed writes try { ObjectReader r = JsonFactory.objectReader(mapper, Map.class); JsonParser parser = mapper.getJsonFactory().createJsonParser(content); try { if (ParsingUtils.seek(new JacksonJsonParser(parser), "items") == null) { return Collections.<Map>emptyList().iterator(); } else { return r.readValues(parser); } } finally { countStreamStats(content); } } catch (IOException ex) { throw new EsHadoopParsingException(ex); } }
public static Map<String, Object> asMap(InputStream inputStream) { Map<String, Object> map; try { // create parser manually to lower Jackson requirements JsonParser jsonParser = MAPPER.getJsonFactory().createJsonParser(inputStream); map = MAPPER.readValue(jsonParser, Map.class); } catch (IOException ex) { throw new EsHadoopParsingException(ex); } return map; }
abortException = new EsHadoopParsingException(ahe.getMessage(), ahe.getCause()); } catch (Exception e) { throw (EsHadoopParsingException) abortException; } else { throw new EsHadoopParsingException(abortException); throw new EsHadoopParsingException("Could not read hit from scroll response.");
throw new EsHadoopParsingException(String.format(Locale.ROOT, "Cannot parse value [%s] for field [%s]", rawValue, fieldName), ex);
throw new EsHadoopParsingException("Different node mapping " + absoluteName + "|" + nodeMapping);
@SuppressWarnings("unchecked") private <T> T parseContent(InputStream content, String string) { Map<String, Object> map = Collections.emptyMap(); try { // create parser manually to lower Jackson requirements JsonParser jsonParser = mapper.getJsonFactory().createJsonParser(content); try { map = mapper.readValue(jsonParser, Map.class); } finally { countStreamStats(content); } } catch (IOException ex) { throw new EsHadoopParsingException(ex); } return (T) (string != null ? map.get(string) : map); }
@SuppressWarnings("unchecked") private <T> T parseContent(InputStream content, String string) { Map<String, Object> map = Collections.emptyMap(); try { // create parser manually to lower Jackson requirements JsonParser jsonParser = mapper.getJsonFactory().createJsonParser(content); try { map = mapper.readValue(jsonParser, Map.class); } finally { countStreamStats(content); } } catch (IOException ex) { throw new EsHadoopParsingException(ex); } return (T) (string != null ? map.get(string) : map); }
@SuppressWarnings("unchecked") private <T> T parseContent(InputStream content, String string) { Map<String, Object> map = Collections.emptyMap(); try { // create parser manually to lower Jackson requirements JsonParser jsonParser = mapper.getJsonFactory().createJsonParser(content); try { map = mapper.readValue(jsonParser, Map.class); } finally { countStreamStats(content); } } catch (IOException ex) { throw new EsHadoopParsingException(ex); } return (T) (string != null ? map.get(string) : map); }
@SuppressWarnings("unchecked") private <T> T parseContent(InputStream content, String string) { Map<String, Object> map = Collections.emptyMap(); try { // create parser manually to lower Jackson requirements JsonParser jsonParser = mapper.getJsonFactory().createJsonParser(content); try { map = mapper.readValue(jsonParser, Map.class); } finally { countStreamStats(content); } } catch (IOException ex) { throw new EsHadoopParsingException(ex); } return (T) (string != null ? map.get(string) : map); }
if (count != null) { if (!"eq".equals(relation)) { throw new EsHadoopParsingException("Count operation returned non-exact count of [" + relation + "][" + count + "]");
if (count != null) { if (!"eq".equals(relation)) { throw new EsHadoopParsingException("Count operation returned non-exact count of [" + relation + "][" + count + "]");
if (count != null) { if (!"eq".equals(relation)) { throw new EsHadoopParsingException("Count operation returned non-exact count of [" + relation + "][" + count + "]");
throw new EsHadoopParsingException("Could not discern relative value of total hits. Response missing [relation] field."); } else if (!"eq".equals(relation)) { throw new EsHadoopParsingException( String.format("Could not discern exact hit count for search response. Received [%s][%s]", relation, throw new EsHadoopParsingException("Could not locate total number of hits for search result.");
protected Object read(String fieldName, Token t, String fieldMapping) { if (t == Token.START_ARRAY) { return list(fieldName, fieldMapping); } // handle nested nodes first else if (t == Token.START_OBJECT) { return map(fieldMapping); } FieldType esType = mapping(fieldMapping); if (t.isValue()) { String rawValue = parser.text(); try { return parseValue(esType); } catch (Exception ex) { throw new EsHadoopParsingException(String.format(Locale.ROOT, "Cannot parse value [%s] for field [%s]", rawValue, fieldName), ex); } } return null; }
@SuppressWarnings("rawtypes") Iterator<Map> parseBulkActionResponse(Response response) { InputStream content = response.body(); // Check for failed writes try { ObjectReader r = JsonFactory.objectReader(mapper, Map.class); JsonParser parser = mapper.getJsonFactory().createJsonParser(content); try { if (ParsingUtils.seek(new JacksonJsonParser(parser), "items") == null) { return Collections.<Map>emptyList().iterator(); } else { return r.readValues(parser); } } finally { countStreamStats(content); } } catch (IOException ex) { throw new EsHadoopParsingException(ex); } }
throw new EsHadoopParsingException("Could not discern relative value of total hits. Response missing [relation] field."); } else if (!"eq".equals(relation)) { throw new EsHadoopParsingException( String.format("Could not discern exact hit count for search response. Received [%s][%s]", relation, throw new EsHadoopParsingException("Could not locate total number of hits for search result.");