Examples of mapperService()


Examples of org.elasticsearch.index.service.IndexService.mapperService()

    @Test
    public void testSimpleMapper() throws Exception {
        IndexService indexService = createIndex("test");
        Settings settings = indexService.settingsService().getSettings();
        DocumentMapperParser mapperParser = indexService.mapperService().documentMapperParser();
        DocumentMapper docMapper = doc("test", settings,
                rootObject("person")
                        .add(object("name").add(stringField("first").store(true).index(false)))
        ).build(mapperParser);
View Full Code Here

Examples of org.elasticsearch.index.service.IndexService.mapperService()

    @Test
    public void testNoDocumentSent() throws Exception {
        IndexService indexService = createIndex("test");
        Settings settings = indexService.settingsService().getSettings();
        DocumentMapperParser mapperParser = indexService.mapperService().documentMapperParser();
        DocumentMapper docMapper = doc("test", settings,
                rootObject("person")
                        .add(object("name").add(stringField("first").store(true).index(false)))
        ).build(mapperParser);
View Full Code Here

Examples of org.elasticsearch.index.service.IndexService.mapperService()

        String mapping = XContentFactory.jsonBuilder().startObject().startObject("my_type")
                .startObject("_source").array("includes", "custom_field_path.").endObject()
                .endObject().endObject().string();
        client().admin().indices().preparePutMapping("test").setType("my_type").setSource(mapping).get();

        DocumentMapper mapper = indexService.mapperService().documentMapper("my_type");
        assertThat(mapper.type(), equalTo("my_type"));
        assertThat(mapper.sourceMapper().includes().length, equalTo(2));
        List<String> includes = Arrays.asList(mapper.sourceMapper().includes());
        assertThat("default_field_path.", isIn(includes));
        assertThat("custom_field_path.", isIn(includes));
View Full Code Here

Examples of org.elasticsearch.index.service.IndexService.mapperService()

        mapping = XContentFactory.jsonBuilder().startObject().startObject("my_type")
                .startObject("properties").startObject("text").field("type", "string").endObject().endObject()
                .endObject().endObject().string();
        client().admin().indices().preparePutMapping("test").setType("my_type").setSource(mapping).get();

        mapper = indexService.mapperService().documentMapper("my_type");
        assertThat(mapper.type(), equalTo("my_type"));
        includes = Arrays.asList(mapper.sourceMapper().includes());
        assertThat("default_field_path.", isIn(includes));
        assertThat("custom_field_path.", isIn(includes));
        assertThat(mapper.sourceMapper().includes().length, equalTo(2));
View Full Code Here

Examples of org.elasticsearch.index.service.IndexService.mapperService()

    @Before
    public void setup() throws IOException {
        IndexService indexService = createIndex("test");
        injector = indexService.injector();

        MapperService mapperService = indexService.mapperService();
        String mapping = copyToStringFromClasspath("/org/elasticsearch/index/query/mapping.json");
        mapperService.merge("person", new CompressedString(mapping), true);
        mapperService.documentMapper("person").parse(new BytesArray(copyToBytesFromClasspath("/org/elasticsearch/index/query/data.json")));
        queryParser = injector.getInstance(IndexQueryParserService.class);
    }
View Full Code Here

Examples of org.elasticsearch.index.service.IndexService.mapperService()

                            .endObject()
                        .endObject()
                    .endObject().string();

            try {
                indexService.mapperService().documentMapperParser().parse(mapping);
                fail("Test should have failed because [null_value] was null.");
            } catch (MapperParsingException e) {
                assertThat(e.getMessage(), equalTo("Property [null_value] cannot be null."));
            }
View Full Code Here

Examples of org.elasticsearch.index.shard.service.IndexShard.mapperService()

                context.size(0);
            }

            // parse the source either into one MemoryIndex, if it is a single document or index multiple docs if nested
            PercolatorIndex percolatorIndex;
            boolean isNested = indexShard.mapperService().documentMapper(request.documentType()).hasNestedObjects();
            if (parsedDocument.docs().size() > 1) {
                assert isNested;
                percolatorIndex = multi;
            } else {
                percolatorIndex = single;
View Full Code Here

Examples of org.elasticsearch.search.internal.SearchContext.mapperService()

        FieldMapper fieldMapper = mock(FieldMapper.class, Answers.RETURNS_MOCKS.get());
        when(smartNameFieldMappers.mapper()).thenReturn(fieldMapper);
        when(fieldMapper.searchAnalyzer()).thenReturn(analyzer);

        MapperService mapperService = mock(MapperService.class);
        when(searchContext.mapperService()).thenReturn(mapperService);
        when(mapperService.searchAnalyzer()).thenReturn(analyzer);

        MatchQueryBuilder builder = new io.crate.lucene.match.MultiMatchQueryBuilder(
                searchContext, cache, new BytesRef("cross_fields"), Collections.emptyMap());
        Map<String, Object> fields = MapBuilder.<String, Object>newMapBuilder()
View Full Code Here

Examples of org.elasticsearch.search.internal.SearchContext.mapperService()

    private SearchContext mockSearchContext() {
        Analyzer analyzer = new GermanAnalyzer(Version.LUCENE_4_9);
        SearchContext searchContext = mock(SearchContext.class);
        MapperService mapperService = mock(MapperService.class);
        when(searchContext.mapperService()).thenReturn(mapperService);
        when(mapperService.searchAnalyzer()).thenReturn(analyzer);
        return searchContext;
    }
}
View Full Code Here

Examples of org.elasticsearch.search.internal.SearchContext.mapperService()

        ShardSearchRequest request = new ShardSearchRequest();
        request.types(new String[]{Constants.DEFAULT_MAPPING_TYPE});

        SearchContext searchContext = mock(SearchContext.class);
        when(searchContext.mapperService()).thenReturn(mapperService);
        when(searchContext.fieldData()).thenReturn(ifd);
        ctx = new CollectorContext().searchContext(searchContext);
    }

    @After
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.