Package org.elasticsearch.hadoop.serialization

Examples of org.elasticsearch.hadoop.serialization.FieldType


            // check type first
            Object type = content.get("type");
            if (type instanceof String) {
                String typeString = type.toString();
                FieldType fieldType = FieldType.parse(typeString);

                // handle multi_field separately
                if (FieldType.MULTI_FIELD == fieldType) {
                    // get fields
                    Map<String, Object> fields = (Map<String, Object>) content.get("fields");
                    // return default field
                    Map<String, Object> defaultField = (Map<String, Object>) fields.get(key);

                    FieldType defaultType = null;

                    // check if there's no default field - corner case but is possible on 0.90
                    // if so, check the field types and if all are the same, use that
                    if (defaultField == null) {
                        String defaultFieldName = null;
                        for (Entry<String, Object> subfield : fields.entrySet()) {
                            Map<String, Object> subFieldDef = (Map<String, Object>) subfield.getValue();
                            FieldType subFieldType = FieldType.parse(subFieldDef.get("type").toString());
                            if (defaultType != null) {
                                if (defaultType != subFieldType) {
                                    throw new EsHadoopIllegalArgumentException(
                                            String.format("Ambiguous mapping, multi_field [%s] provides no default field and subfields have different mapping types [%s=%s], [%s=%s]",
                                                    key, defaultFieldName, defaultType, subfield.getKey(), subFieldType));
View Full Code Here

TOP

Related Classes of org.elasticsearch.hadoop.serialization.FieldType

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.