@Test
public void supportElasticsearchPermissiveSourceFilteringSyntax() {

    String query = "{\"query\" : { \"term\" : { \"name\" : \"KangSungJeon\" } }, \"_source\": false}";
    String includePatternItem1 = "SeolaIncludeFieldName";
    String excludePatternItem1 = "SeolaExcludeField.*";
    Action search = new Search.Builder(query)
            .addSourceIncludePattern(includePatternItem1)
            .addSourceExcludePattern(excludePatternItem1)
            .build();
    JsonParser parser = new JsonParser();
    JsonElement parsed = parser.parse(search.getData(new Gson()).toString());
    JsonObject obj = parsed.getAsJsonObject();
    JsonObject source = obj.getAsJsonObject("_source");
    JsonArray includePattern = source.getAsJsonArray("includes");
    assertEquals(1, includePattern.size());
    assertEquals(includePatternItem1, includePattern.get(0).getAsString());
    JsonArray excludePattern = source.getAsJsonArray("excludes");
    assertEquals(1, excludePattern.size());
    assertEquals(excludePatternItem1, excludePattern.get(0).getAsString());
    query = "{\"query\" : { \"term\" : { \"name\" : \"KangSungJeon\" } }, \"_source\": [\"includeFieldName1\", \"includeFieldName2\"]}";
    search = new Search.Builder(query)
            .addSourceIncludePattern(includePatternItem1)
            .addSourceExcludePattern(excludePatternItem1)
            .build();
    parsed = parser.parse(search.getData(new Gson()).toString());
    obj = parsed.getAsJsonObject();
    source = obj.getAsJsonObject("_source");
    includePattern = source.getAsJsonArray("includes");
    assertEquals(3, includePattern.size());
    assertEquals("includeFieldName1", includePattern.get(0).getAsString());
    assertEquals("includeFieldName2", includePattern.get(1).getAsString());
    assertEquals(includePatternItem1, includePattern.get(2).getAsString());
    excludePattern = source.getAsJsonArray("excludes");
    assertEquals(1, excludePattern.size());
    assertEquals(excludePatternItem1, excludePattern.get(0).getAsString());
}