Package crate.elasticsearch.action.searchinto

Examples of crate.elasticsearch.action.searchinto.SearchIntoRequest.source()


    public void testSearchIntoWithoutSource() {
        esSetup.execute(createIndex("test").withMapping("a",
                "{\"a\":{\"_source\": {\"enabled\": false}}}"));
        esSetup.execute(index("test", "a", "1").withSource("{\"name\": \"John\"}"));
        SearchIntoRequest request = new SearchIntoRequest("test");
        request.source("{\"fields\": [\"_id\", \"_source\", [\"_index\", \"'newindex'\"]]}");
        SearchIntoResponse res = esSetup.client().execute(SearchIntoAction.INSTANCE, request).actionGet();
        assertEquals(1, res.getFailedShards());
        assertTrue(res.getShardFailures()[0].reason().contains("Parse Failure [The _source field of index test and type a is not stored.]"));
    }
View Full Code Here


    @Test
    public void testNestedObjectsRewriting() {
        prepareNested();
        SearchIntoRequest request = new SearchIntoRequest("test");
        request.source("{\"fields\": [\"_id\", [\"x.city\", \"_source.city\"], [\"x.surname\", \"_source.name.surname\"], [\"x.name\", \"_source.name.name\"], [\"_index\", \"'newindex'\"]]}");
        SearchIntoResponse res = esSetup.client().execute(SearchIntoAction.INSTANCE, request).actionGet();

        GetRequestBuilder rb = new GetRequestBuilder(esSetup.client(), "newindex");
        GetResponse getRes = rb.setType("a").setId("1").execute().actionGet();
        assertTrue(getRes.isExists());
View Full Code Here

    @Test
    public void testNestedObjectsRewritingMixed1() {
        prepareNested();
        SearchIntoRequest request = new SearchIntoRequest("test");
        request.source("{\"fields\": [\"_id\", [\"x\", \"_source.city\"], [\"x.surname\", \"_source.name.surname\"], [\"x.name\", \"_source.name.name\"], [\"_index\", \"'newindex'\"]]}");
        SearchIntoResponse res = esSetup.client().execute(SearchIntoAction.INSTANCE, request).actionGet();
        assertTrue(res.getShardFailures()[0].reason().contains("Error on rewriting objects: Mixed objects and values]"));
    }

    @Test
View Full Code Here

    @Test
    public void testNestedObjectsRewritingMixed2() {
        prepareNested();
        SearchIntoRequest request = new SearchIntoRequest("test");
        request.source("{\"fields\": [\"_id\", [\"x.surname.bad\", \"_source.city\"], [\"x.surname\", \"_source.name.surname\"], [\"x.name\", \"_source.name.name\"], [\"_index\", \"'newindex'\"]]}");
        SearchIntoResponse res = esSetup.client().execute(SearchIntoAction.INSTANCE, request).actionGet();
        assertTrue(res.getShardFailures()[0].reason().contains("Error on rewriting objects: Mixed objects and values]"));
    }

    @Test
View Full Code Here

    @Test
    public void testNestedObjectsRewritingMixed3() {
        prepareNested();
        SearchIntoRequest request = new SearchIntoRequest("test");
        request.source("{\"fields\": [\"_id\", [\"x.surname\", \"_source.city\"], [\"x.surname.bad\", \"_source.name.surname\"], [\"x.name\", \"_source.name.name\"], [\"_index\", \"'newindex'\"]]}");
        SearchIntoResponse res = esSetup.client().execute(SearchIntoAction.INSTANCE, request).actionGet();
        assertTrue(res.getShardFailures()[0].reason().contains("Error on rewriting objects: Mixed objects and values]"));
    }

View Full Code Here

                // but change it to a single thread
                operationThreading = BroadcastOperationThreading.SINGLE_THREAD;
            }
            searchIntoRequest.operationThreading(operationThreading);
            if (request.hasContent()) {
                searchIntoRequest.source(request.content(),
                        request.contentUnsafe());
            } else {
                String source = request.param("source");
                if (source != null) {
                    searchIntoRequest.source(source);
View Full Code Here

                searchIntoRequest.source(request.content(),
                        request.contentUnsafe());
            } else {
                String source = request.param("source");
                if (source != null) {
                    searchIntoRequest.source(source);
                } else {
                    BytesReference querySource = RestActions.parseQuerySource(
                            request);
                    if (querySource != null) {
                        searchIntoRequest.source(querySource, false);
View Full Code Here

                    searchIntoRequest.source(source);
                } else {
                    BytesReference querySource = RestActions.parseQuerySource(
                            request);
                    if (querySource != null) {
                        searchIntoRequest.source(querySource, false);
                    }
                }
            }
            searchIntoRequest.routing(request.param("routing"));
            searchIntoRequest.types(splitTypes(request.param("type")));
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.