Example #1
0
 @Override
 public int hashCode() {
   int result = alias != null ? alias.hashCode() : 0;
   result = 31 * result + (filter != null ? filter.hashCode() : 0);
   result = 31 * result + (indexRouting != null ? indexRouting.hashCode() : 0);
   result = 31 * result + (searchRouting != null ? searchRouting.hashCode() : 0);
   return result;
 }
 public static IndexTemplateMetaData readFrom(StreamInput in) throws IOException {
   Builder builder = new Builder(in.readUTF());
   builder.order(in.readInt());
   builder.template(in.readUTF());
   builder.settings(ImmutableSettings.readSettingsFromStream(in));
   int mappingsSize = in.readVInt();
   for (int i = 0; i < mappingsSize; i++) {
     builder.putMapping(in.readUTF(), CompressedString.readCompressedString(in));
   }
   return builder.build();
 }
 private void testNoConflictWhileMergingAndMappingChanged(
     XContentBuilder mapping, XContentBuilder mappingUpdate, XContentBuilder expectedMapping)
     throws IOException {
   IndexService indexService =
       createIndex("test", ImmutableSettings.settingsBuilder().build(), "type", mapping);
   // simulate like in MetaDataMappingService#putMapping
   DocumentMapper.MergeResult mergeResult =
       indexService
           .mapperService()
           .documentMapper("type")
           .merge(
               indexService
                   .mapperService()
                   .parse("type", new CompressedString(mappingUpdate.bytes()), true),
               DocumentMapper.MergeFlags.mergeFlags().simulate(false));
   // assure we have no conflicts
   assertThat(mergeResult.conflicts().length, equalTo(0));
   // make sure mappings applied
   CompressedString mappingAfterUpdate =
       indexService.mapperService().documentMapper("type").mappingSource();
   assertThat(mappingAfterUpdate.toString(), equalTo(expectedMapping.string()));
 }
Example #4
0
 public static AliasMetaData readFrom(StreamInput in) throws IOException {
   String alias = in.readString();
   CompressedString filter = null;
   if (in.readBoolean()) {
     filter = CompressedString.readCompressedString(in);
   }
   String indexRouting = null;
   if (in.readBoolean()) {
     indexRouting = in.readString();
   }
   String searchRouting = null;
   if (in.readBoolean()) {
     searchRouting = in.readString();
   }
   return new AliasMetaData(alias, filter, indexRouting, searchRouting);
 }
Example #5
0
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    AliasMetaData that = (AliasMetaData) o;

    if (alias != null ? !alias.equals(that.alias) : that.alias != null) return false;
    if (filter != null ? !filter.equals(that.filter) : that.filter != null) return false;
    if (indexRouting != null ? !indexRouting.equals(that.indexRouting) : that.indexRouting != null)
      return false;
    if (searchRouting != null
        ? !searchRouting.equals(that.searchRouting)
        : that.searchRouting != null) return false;

    return true;
  }