@Test
  public void testMerge() throws IOException {
    String stage1Mapping =
        XContentFactory.jsonBuilder()
            .startObject()
            .startObject("person")
            .startObject("properties")
            .startObject("tc")
            .field("type", "token_count")
            .field("analyzer", "keyword")
            .endObject()
            .endObject()
            .endObject()
            .endObject()
            .string();
    DocumentMapperParser parser = createIndex("test").mapperService().documentMapperParser();
    DocumentMapper stage1 = parser.parse(stage1Mapping);

    String stage2Mapping =
        XContentFactory.jsonBuilder()
            .startObject()
            .startObject("person")
            .startObject("properties")
            .startObject("tc")
            .field("type", "token_count")
            .field("analyzer", "standard")
            .endObject()
            .endObject()
            .endObject()
            .endObject()
            .string();
    DocumentMapper stage2 = parser.parse(stage2Mapping);

    MergeResult mergeResult = stage1.merge(stage2.mapping(), true, false);
    assertThat(mergeResult.hasConflicts(), equalTo(false));
    // Just simulated so merge hasn't happened yet
    assertThat(
        ((TokenCountFieldMapper) stage1.mappers().smartNameFieldMapper("tc")).analyzer(),
        equalTo("keyword"));

    mergeResult = stage1.merge(stage2.mapping(), false, false);
    assertThat(mergeResult.hasConflicts(), equalTo(false));
    // Just simulated so merge hasn't happened yet
    assertThat(
        ((TokenCountFieldMapper) stage1.mappers().smartNameFieldMapper("tc")).analyzer(),
        equalTo("standard"));
  }
  @Override
  public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
    super.merge(mergeWith, mergeResult);
    if (!this.getClass().equals(mergeWith.getClass())) {
      return;
    }

    GeoShapeFieldMapper gsfm = (GeoShapeFieldMapper) mergeWith;
    if (mergeResult.simulate() == false && mergeResult.hasConflicts() == false) {
      if (gsfm.coerce.explicit()) {
        this.coerce = gsfm.coerce;
      }
    }
  }