Package org.elasticsearch.common.xcontent

Examples of org.elasticsearch.common.xcontent.XContentBuilder.bytes()


    }
    expected.endObject();

    XContentBuilder actual = fixture.getContentBuilder(event);

    assertEquals(new String(expected.bytes().array()), new String(actual
        .bytes().array()));

  }
}
View Full Code Here


    expected.endObject();

    expected.endObject();

    XContentBuilder actual = fixture.getContentBuilder(event);
    assertEquals(new String(expected.bytes().array()), new String(actual
        .bytes().array()));
  }

  @Test
  public void shouldHandleInvalidJSONDuringComplexParsing() throws Exception {
View Full Code Here

    expected.endObject();

    expected.endObject();

    XContentBuilder actual = fixture.getContentBuilder(event);
    assertEquals(new String(expected.bytes().array()), new String(actual
        .bytes().array()));
  }
}
View Full Code Here

    }
    expected.endObject();

    XContentBuilder actual = fixture.getContentBuilder(event);

    assertEquals(new String(expected.bytes().array()), new String(actual
        .bytes().array()));

  }
}
View Full Code Here

    expected.endObject();

    expected.endObject();

    XContentBuilder actual = fixture.getContentBuilder(event);
    assertEquals(new String(expected.bytes().array()), new String(actual
        .bytes().array()));
  }

  @Test
  public void shouldHandleInvalidJSONDuringComplexParsing() throws Exception {
View Full Code Here

    expected.endObject();

    expected.endObject();

    XContentBuilder actual = fixture.getContentBuilder(event);
    assertEquals(new String(expected.bytes().array()), new String(actual
        .bytes().array()));
  }
}
View Full Code Here

            xcb.field("_language", forcedLanguage[0]);
        }

        xcb.endObject().endObject();

        ParseContext.Document doc =  docMapper.parse(xcb.bytes()).rootDoc();

        // Our mapping should be kept as a String
        assertThat(doc.get(docMapper.mappers().smartName("file.language").mapper().names().indexName()), equalTo(expected));
    }
View Full Code Here

                    .field("_name", "text-in-english.txt")
                    .field("_content", html)
                    .field("_detect_language", true)
                .endObject().endObject();

        ParseContext.Document doc =  docMapper.parse(xcb.bytes()).rootDoc();

        // Our mapping should be kept as a String
        assertThat(doc.get(docMapper.mappers().smartName("file.language").mapper().names().indexName()), equalTo("en"));
    }
}
View Full Code Here

    protected SuggestRequest request() {
        SuggestRequest suggestRequest = super.request();
        try {
            XContentBuilder builder = XContentFactory.contentBuilder(Requests.CONTENT_TYPE);
            suggest.toXContent(builder, ToXContent.EMPTY_PARAMS);
            suggestRequest.suggest(builder.bytes());
        } catch (IOException e) {
            throw new ElasticSearchException("Unable to build suggestion request", e);
        }
        return suggestRequest;
    }
View Full Code Here

    log.debug("filteredSource " + filteredSource);

    final XContentBuilder sourceToBeReturned = XContentFactory
        .contentBuilder(mapTuple.v1()).map(filteredSource);
    return sourceToBeReturned.bytes();

  }

}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.