Package org.elasticsearch.search.fetch.source

Examples of org.elasticsearch.search.fetch.source.FetchSourceContext.fetchSource()


            assertThat(item.index(), is("test"));
            assertThat(item.type(), is("type"));
            FetchSourceContext fetchSource = item.fetchSourceContext();
            switch (item.id()) {
                case "1" :
                    assertThat(fetchSource.fetchSource(), is(false));
                    break;
                case "2" :
                    assertThat(fetchSource.fetchSource(), is(true));
                    assertThat(fetchSource.includes(), is(new String[]{"field3", "field4"}));
                    break;
View Full Code Here


            switch (item.id()) {
                case "1" :
                    assertThat(fetchSource.fetchSource(), is(false));
                    break;
                case "2" :
                    assertThat(fetchSource.fetchSource(), is(true));
                    assertThat(fetchSource.includes(), is(new String[]{"field3", "field4"}));
                    break;
                case "3" :
                    assertThat(fetchSource.fetchSource(), is(true));
                    assertThat(fetchSource.includes(), is(new String[]{"user"}));
View Full Code Here

                case "2" :
                    assertThat(fetchSource.fetchSource(), is(true));
                    assertThat(fetchSource.includes(), is(new String[]{"field3", "field4"}));
                    break;
                case "3" :
                    assertThat(fetchSource.fetchSource(), is(true));
                    assertThat(fetchSource.includes(), is(new String[]{"user"}));
                    assertThat(fetchSource.excludes(), is(new String[]{"user.location"}));
                    break;
                default:
                    fail("item with id: " + item.id() + " is not 1, 2 or 3");
View Full Code Here

        FetchSourceContext context = request.fetchSourceContext();
        if (context == null) {
            request.fetchSourceContext(new FetchSourceContext(fetch));
        }
        else {
            context.fetchSource(fetch);
        }
        return this;
    }

    /**
 
View Full Code Here

        FetchSourceContext context = request.fetchSourceContext();
        if (context == null) {
            request.fetchSourceContext(new FetchSourceContext(includes, excludes));
        }
        else {
            context.fetchSource(true);
            context.includes(includes);
            context.excludes(excludes);
        }
        return this;
    }
View Full Code Here

        FetchSourceContext context = request.fetchSourceContext();
        if (context == null) {
            request.fetchSourceContext(new FetchSourceContext(includes, excludes));
        }
        else {
            context.fetchSource(true);
            context.includes(includes);
            context.excludes(excludes);
        }
        return this;
    }
View Full Code Here

            if (this.fetchSourceContext() != null) {
                FetchSourceContext source = this.fetchSourceContext();
                String[] includes = source.includes();
                String[] excludes = source.excludes();
                if (includes.length == 0 && excludes.length == 0) {
                    builder.field("_source", source.fetchSource());
                } else if (includes.length > 0 && excludes.length == 0) {
                    builder.array("_source", source.includes());
                } else if (excludes.length > 0) {
                    builder.startObject("_source");
                    if (includes.length > 0) {
View Full Code Here

        FetchSourceContext context = request.fetchSourceContext();
        if (context == null) {
            request.fetchSourceContext(new FetchSourceContext(fetch));
        }
        else {
            context.fetchSource(fetch);
        }
        return this;
    }

    /**
 
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.