Package org.elasticsearch.index.mapper.core

Examples of org.elasticsearch.index.mapper.core.CompletionFieldMapper


            }
        }
       
        suggestion.mapper((CompletionFieldMapper)mapperService.smartNameFieldMapper(suggestion.getField()));

        CompletionFieldMapper mapper = suggestion.mapper();
        if (mapper != null) {
            if (mapper.requiresContext()) {
                if (contextParser == null) {
                    throw new ElasticsearchIllegalArgumentException("suggester [completion] requires context to be setup");
                } else {
                    contextParser.nextToken();
                    List<ContextQuery> contextQueries = ContextQuery.parseQueries(mapper.getContextMapping(), contextParser);
                    suggestion.setContextQuery(contextQueries);
                }
            } else if (contextParser != null) {
                throw new ElasticsearchIllegalArgumentException("suggester [completion] doesn't expect any context");
            }
View Full Code Here


        DocumentMapper defaultMapper = createIndex("test").mapperService().documentMapperParser().parse(mapping);

        FieldMapper fieldMapper = defaultMapper.mappers().name("completion").mapper();
        assertThat(fieldMapper, instanceOf(CompletionFieldMapper.class));

        CompletionFieldMapper completionFieldMapper = (CompletionFieldMapper) fieldMapper;
        assertThat(completionFieldMapper.isStoringPayloads(), is(false));
    }
View Full Code Here

        DocumentMapper defaultMapper = createIndex("test").mapperService().documentMapperParser().parse(mapping);

        FieldMapper fieldMapper = defaultMapper.mappers().name("completion").mapper();
        assertThat(fieldMapper, instanceOf(CompletionFieldMapper.class));

        CompletionFieldMapper completionFieldMapper = (CompletionFieldMapper) fieldMapper;
        XContentBuilder builder = jsonBuilder().startObject();
        completionFieldMapper.toXContent(builder, null).endObject();
        builder.close();
        Map<String, Object> serializedMap = JsonXContent.jsonXContent.createParser(builder.bytes()).mapAndClose();
        Map<String, Object> configMap = (Map<String, Object>) serializedMap.get("completion");
        assertThat(configMap.get("index_analyzer").toString(), is("simple"));
        assertThat(configMap.get("search_analyzer").toString(), is("standard"));
View Full Code Here

        DocumentMapper defaultMapper = createIndex("test").mapperService().documentMapperParser().parse(mapping);

        FieldMapper fieldMapper = defaultMapper.mappers().name("completion").mapper();
        assertThat(fieldMapper, instanceOf(CompletionFieldMapper.class));

        CompletionFieldMapper completionFieldMapper = (CompletionFieldMapper) fieldMapper;
        XContentBuilder builder = jsonBuilder().startObject();
        completionFieldMapper.toXContent(builder, null).endObject();
        builder.close();
        Map<String, Object> serializedMap = JsonXContent.jsonXContent.createParser(builder.bytes()).mapAndClose();
        Map<String, Object> configMap = (Map<String, Object>) serializedMap.get("completion");
        assertThat(configMap.get("analyzer").toString(), is("simple"));
    }
View Full Code Here

TOP

Related Classes of org.elasticsearch.index.mapper.core.CompletionFieldMapper

Copyright © 2018 www.massapicom. 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.