Package org.elasticsearch.hadoop.serialization.dto.mapping

Examples of org.elasticsearch.hadoop.serialization.dto.mapping.Field


            // get original copy
            Settings settings = CascadingUtils.addDefaultsToSettings(CascadingUtils.extractOriginalProperties(flowProcess.getConfigCopy()), tapProperties, log);

            // will be closed by the query is finished
            RestRepository client = new RestRepository(settings);
            Field mapping = client.getMapping();
            Collection<String> fields = CascadingUtils.fieldToAlias(settings, getSourceFields());

            // validate if possible
            FieldPresenceValidation validation = settings.getFieldExistanceValidation();
            if (validation.isRequired()) {
View Full Code Here


public class FieldTest {

    @Test
    public void testNestedObjectParsing() throws Exception {
        Map value = new ObjectMapper().readValue(getClass().getResourceAsStream("nested.json"), Map.class);
        Field fl = Field.parseField(value);
        assertEquals("artiststimestamp", fl.name());
        Field[] properties = fl.properties();
        Field first = properties[0];
        assertEquals("date", first.name());
        assertEquals(FieldType.DATE, first.type());
        Field second = properties[1];
        assertEquals(FieldType.OBJECT, second.type());
        assertEquals("links", second.name());
        Field[] secondProps = second.properties();
        assertEquals("url", secondProps[0].name());
        assertEquals(FieldType.STRING, secondProps[0].type());
    }
View Full Code Here

    }

    @Test
    public void testBasicParsing() throws Exception {
        Map value = new ObjectMapper().readValue(getClass().getResourceAsStream("basic.json"), Map.class);
        Field fl = Field.parseField(value);
    }
View Full Code Here

    }

    @Test
    public void testMultiFieldParsing() throws Exception {
        Map value = new ObjectMapper().readValue(getClass().getResourceAsStream("multi_field.json"), Map.class);
        Field fl = Field.parseField(value);
        assertEquals("tweet", fl.name());
        assertEquals(1, fl.properties().length);
        Field nested = fl.properties()[0];
        assertEquals("name", nested.name());
        assertEquals(FieldType.STRING, nested.type());
    }
View Full Code Here

    }

    @Test
    public void testMultiFieldWithoutDefaultFieldParsing() throws Exception {
        Map value = new ObjectMapper().readValue(getClass().getResourceAsStream("multi_field_no_default.json"), Map.class);
        Field fl = Field.parseField(value);
        assertEquals("tweet", fl.name());
        assertEquals(1, fl.properties().length);
        Field nested = fl.properties()[0];
        assertEquals("name", nested.name());
        assertEquals(FieldType.STRING, nested.type());
    }
View Full Code Here

    @Test(expected = EsHadoopIllegalArgumentException.class)
    public void testMultiFieldWithoutDefaultFieldAndMultiTypesParsing() throws Exception {
        Map value = new ObjectMapper().readValue(
                getClass().getResourceAsStream("multi_field_no_default_multi_types.json"), Map.class);
        Field fl = Field.parseField(value);
        assertEquals("tweet", fl.name());
        assertEquals(1, fl.properties().length);
        Field nested = fl.properties()[0];
        assertEquals("name", nested.name());
        assertEquals(FieldType.STRING, nested.type());
    }
View Full Code Here

    }

    @Test
    public void testCompletionParsing() throws Exception {
        Map value = new ObjectMapper().readValue(getClass().getResourceAsStream("completion.json"), Map.class);
        Field fl = Field.parseField(value);
        assertEquals("song", fl.name());
        Field[] props = fl.properties();
        assertEquals(1, props.length);
        assertEquals("name", props[0].name());
    }
View Full Code Here

    }

    @Test
    public void testGeolocationParsing() throws Exception {
        Map value = new ObjectMapper().readValue(getClass().getResourceAsStream("geo.json"), Map.class);
        Field fl = Field.parseField(value);
        assertEquals(1, fl.properties().length);
    }
View Full Code Here

    }

    @Test
    public void testIpParsing() throws Exception {
        Map value = new ObjectMapper().readValue(getClass().getResourceAsStream("ip.json"), Map.class);
        Field fl = Field.parseField(value);
        assertEquals(1, fl.properties().length);
    }
View Full Code Here

    }

    @Test
    public void testUnsupportedParsing() throws Exception {
        Map value = new ObjectMapper().readValue(getClass().getResourceAsStream("attachment.json"), Map.class);
        Field fl = Field.parseField(value);
        assertEquals("person", fl.name());
        assertEquals(0, fl.properties().length);
    }
View Full Code Here

TOP

Related Classes of org.elasticsearch.hadoop.serialization.dto.mapping.Field

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.