.field("_id", "1")
.field("a", "-1,-1")
.endObject().bytes();
Document doc = docMapper.parse(json).rootDoc();
IndexableField f = doc.getField("a");
assertThat(f, notNullValue());
assertThat(f.name(), equalTo("a"));
assertThat(f.stringValue(), equalTo("-1,-1"));
assertThat(f.fieldType().stored(), equalTo(false));
assertNotSame(IndexOptions.NONE, f.fieldType().indexOptions());
f = doc.getField("a.b");
assertThat(f, notNullValue());
assertThat(f.name(), equalTo("a.b"));
assertThat(f.stringValue(), equalTo("-1.0,-1.0"));
assertThat(f.fieldType().stored(), equalTo(false));
assertNotSame(IndexOptions.NONE, f.fieldType().indexOptions());
assertThat(docMapper.mappers().fullName("b").mapper(), notNullValue());
assertThat(docMapper.mappers().fullName("b").mapper(), instanceOf(GeoPointFieldMapper.class));
assertNotSame(IndexOptions.NONE, docMapper.mappers().fullName("b").mapper().fieldType().indexOptions());
assertThat(docMapper.mappers().fullName("b").mapper().fieldType().stored(), equalTo(false));
assertThat(docMapper.mappers().fullName("b").mapper().fieldType().tokenized(), equalTo(false));
assertThat(docMapper.mappers().fullName("b.a").mapper(), notNullValue());
assertThat(docMapper.mappers().fullName("b.a").mapper(), instanceOf(StringFieldMapper.class));
assertNotSame(IndexOptions.NONE, docMapper.mappers().fullName("b.a").mapper().fieldType().indexOptions());
assertThat(docMapper.mappers().fullName("b.a").mapper().fieldType().stored(), equalTo(false));
assertThat(docMapper.mappers().fullName("b.a").mapper().fieldType().tokenized(), equalTo(false));
json = jsonBuilder().startObject()
.field("_id", "1")
.field("b", "-1,-1")
.endObject().bytes();
doc = docMapper.parse(json).rootDoc();
f = doc.getField("b");
assertThat(f, notNullValue());
assertThat(f.name(), equalTo("b"));
assertThat(f.stringValue(), equalTo("-1.0,-1.0"));
assertThat(f.fieldType().stored(), equalTo(false));
assertNotSame(IndexOptions.NONE, f.fieldType().indexOptions());
f = doc.getField("b.a");
assertThat(f, notNullValue());
assertThat(f.name(), equalTo("b.a"));
assertThat(f.stringValue(), equalTo("-1,-1"));
assertThat(f.fieldType().stored(), equalTo(false));
assertNotSame(IndexOptions.NONE, f.fieldType().indexOptions());
json = jsonBuilder().startObject()
.field("_id", "1")
.startArray("b").startArray().value(-1).value(-1).endArray().startArray().value(-2).value(-2).endArray().endArray()
.endObject().bytes();
doc = docMapper.parse(json).rootDoc();
f = doc.getFields("b")[0];
assertThat(f, notNullValue());
assertThat(f.name(), equalTo("b"));
assertThat(f.stringValue(), equalTo("-1.0,-1.0"));
assertThat(f.fieldType().stored(), equalTo(false));
assertNotSame(IndexOptions.NONE, f.fieldType().indexOptions());
f = doc.getFields("b")[1];
assertThat(f, notNullValue());
assertThat(f.name(), equalTo("b"));
assertThat(f.stringValue(), equalTo("-2.0,-2.0"));
assertThat(f.fieldType().stored(), equalTo(false));
assertNotSame(IndexOptions.NONE, f.fieldType().indexOptions());
f = doc.getField("b.a");
assertThat(f, notNullValue());
assertThat(f.name(), equalTo("b.a"));
// NOTE: "]" B/c the lat,long aren't specified as a string, we miss the actual values when parsing the multi
// fields. We already skipped over the coordinates values and can't get to the coordinates.
// This happens if coordinates are specified as array and object.
assertThat(f.stringValue(), equalTo("]"));
assertThat(f.fieldType().stored(), equalTo(false));
assertNotSame(IndexOptions.NONE, f.fieldType().indexOptions());
}