@Test public void testEncodeDecodeCommonStats() throws IOException { CommonStatsFlags flags = new CommonStatsFlags(); Flag[] values = CommonStatsFlags.Flag.values(); assertThat(flags.anySet(), equalTo(true)); for (Flag flag : values) { flags.set(flag, false); } assertThat(flags.anySet(), equalTo(false)); for (Flag flag : values) { flags.set(flag, true); } assertThat(flags.anySet(), equalTo(true)); Random random = getRandom(); flags.set(values[random.nextInt(values.length)], false); assertThat(flags.anySet(), equalTo(true)); { BytesStreamOutput out = new BytesStreamOutput(); flags.writeTo(out); out.close(); BytesReference bytes = out.bytes(); CommonStatsFlags readStats = CommonStatsFlags.readCommonStatsFlags(new BytesStreamInput(bytes)); for (Flag flag : values) { assertThat(flags.isSet(flag), equalTo(readStats.isSet(flag))); } } { for (Flag flag : values) { flags.set(flag, random.nextBoolean()); } BytesStreamOutput out = new BytesStreamOutput(); flags.writeTo(out); out.close(); BytesReference bytes = out.bytes(); CommonStatsFlags readStats = CommonStatsFlags.readCommonStatsFlags(new BytesStreamInput(bytes)); for (Flag flag : values) { assertThat(flags.isSet(flag), equalTo(readStats.isSet(flag))); } } }
public IndicesStatsRequest translog(boolean translog) { flags.set(Flag.Translog, translog); return this; }
public IndicesStatsRequest completion(boolean completion) { flags.set(Flag.Completion, completion); return this; }
public IndicesStatsRequest segments(boolean segments) { flags.set(Flag.Segments, segments); return this; }
public IndicesStatsRequest percolate(boolean percolate) { flags.set(Flag.Percolate, percolate); return this; }
public IndicesStatsRequest fieldData(boolean fieldData) { flags.set(Flag.FieldData, fieldData); return this; }
public IndicesStatsRequest indexing(boolean indexing) { flags.set(Flag.Indexing, indexing); return this; }
public IndicesStatsRequest docs(boolean docs) { flags.set(Flag.Docs, docs); return this; }
public IndicesStatsRequest warmer(boolean warmer) { flags.set(Flag.Warmer, warmer); return this; }
public IndicesStatsRequest flush(boolean flush) { flags.set(Flag.Flush, flush); return this; }
public IndicesStatsRequest refresh(boolean refresh) { flags.set(Flag.Refresh, refresh); return this; }
public IndicesStatsRequest merge(boolean merge) { flags.set(Flag.Merge, merge); return this; }
public IndicesStatsRequest search(boolean search) { flags.set(Flag.Search, search); return this; }
public IndicesStatsRequest get(boolean get) { flags.set(Flag.Get, get); return this; }
public IndicesStatsRequest suggest(boolean suggest) { flags.set(Flag.Suggest, suggest); return this; }
public IndicesStatsRequest queryCache(boolean queryCache) { flags.set(Flag.QueryCache, queryCache); return this; }
public IndicesStatsRequest filterCache(boolean filterCache) { flags.set(Flag.FilterCache, filterCache); return this; }
public IndicesStatsRequest store(boolean store) { flags.set(Flag.Store, store); return this; }
public IndicesStatsRequest idCache(boolean idCache) { flags.set(Flag.IdCache, idCache); return this; }