Buggy code:
public class HistogramParser implements Aggregator . Parser { static final ParseField EXTENDED_BOUNDS = new ParseField ( "extended_bounds" ) ; @ Override public String type ( ) { } @ Override public AggregatorFactory parse ( String aggregationName , XContentParser parser , SearchContext context ) throws IOException { ValuesSourceParser vsParser = ValuesSourceParser . numeric ( aggregationName , TYPE , context ) . targetValueType ( NUMERIC ) . formattable ( true ) . build ( ) ; boolean keyed = false ; long minDocCount = 1 ; InternalOrder order = ( ( InternalOrder ) ( InternalOrder . KEY_ASC ) ) ; long interval = - 1 ; ExtendedBounds extendedBounds = null ; long preOffset = 0 ; long postOffset = 0 ; XContentParser . Token token ; String currentFieldName = null ; while ( ( token = parser . nextToken ( ) ) != ( Token . END_OBJECT ) ) { if ( token == ( Token . FIELD_NAME ) ) { currentFieldName = parser . currentName ( ) ; } else if ( vsParser . token ( currentFieldName , token , parser ) ) { continue ; } else if ( token . isValue ( ) ) { if ( "interval" . equals ( currentFieldName ) ) { interval = parser . longValue ( ) ; } else if ( ( "min_doc_count" . equals ( currentFieldName ) ) || ( "minDocCount" . equals ( currentFieldName ) ) ) { minDocCount = parser . longValue ( ) ; } else if ( "keyed" . equals ( currentFieldName ) ) { keyed = parser . booleanValue ( ) ; } else if ( ( "pre_offset" . equals ( currentFieldName ) ) || ( "preOffset" . equals ( currentFieldName ) ) ) { preOffset = parser . longValue ( ) ; } else if ( ( "post_offset" . equals ( currentFieldName ) ) || ( "postOffset" . equals ( currentFieldName ) ) ) { postOffset = parser . longValue ( ) ; } else { throw new org . elasticsearch . search . SearchParseException ( context , ( ( ( ( ( ( "Unknown<seq2seq4repair_space>key<seq2seq4repair_space>for<seq2seq4repair_space>a<seq2seq4repair_space>" + token ) + "<seq2seq4repair_space>in<seq2seq4repair_space>aggregation<seq2seq4repair_space>[" ) + aggregationName ) + "]:<seq2seq4repair_space>[" ) + currentFieldName ) + "]." ) ) ; } } else if ( token == ( Token . START_OBJECT ) ) { if ( "order" . equals ( currentFieldName ) ) { while ( ( token = parser . nextToken ( ) ) != ( Token . END_OBJECT ) ) { if ( token == ( Token . FIELD_NAME ) ) { currentFieldName = parser . currentName ( ) ; } else if ( token == ( Token . VALUE_STRING ) ) { String dir = parser . text ( ) ; boolean asc = "asc" . equals ( dir ) ; if ( ( ! asc ) && ( ! ( "desc" . equals ( dir ) ) ) ) { throw new org . elasticsearch . search . SearchParseException ( context , ( ( ( ( "Unknown<seq2seq4repair_space>order<seq2seq4repair_space>direction<seq2seq4repair_space>[" + dir ) + "]<seq2seq4repair_space>in<seq2seq4repair_space>aggregation<seq2seq4repair_space>[" ) + aggregationName ) + "].<seq2seq4repair_space>Should<seq2seq4repair_space>be<seq2seq4repair_space>either<seq2seq4repair_space>[asc]<seq2seq4repair_space>or<seq2seq4repair_space>[desc]" ) ) ; } order = HistogramParser . resolveOrder ( currentFieldName , asc ) ; } } } else if ( HistogramParser . EXTENDED_BOUNDS . match ( currentFieldName ) ) { extendedBounds = new ExtendedBounds ( ) ; while ( ( token = parser . nextToken ( ) ) != ( Token . END_OBJECT ) ) { if ( token == ( Token . FIELD_NAME ) ) { currentFieldName = parser . currentName ( ) ; } else if ( token . isValue ( ) ) { if ( "min" . equals ( currentFieldName ) ) { extendedBounds . min = parser . longValue ( true ) ; } else if ( "max" . equals ( currentFieldName ) ) { extendedBounds . max = parser . longValue ( true ) ; } else { throw new org . elasticsearch . search . SearchParseException ( context , ( ( ( ( ( ( "Unknown<seq2seq4repair_space>extended_bounds<seq2seq4repair_space>key<seq2seq4repair_space>for<seq2seq4repair_space>a<seq2seq4repair_space>" + token ) + "<seq2seq4repair_space>in<seq2seq4repair_space>aggregation<seq2seq4repair_space>[" ) + aggregationName ) + "]:<seq2seq4repair_space>[" ) + currentFieldName ) + "]." ) ) ; } } } } else { throw new org . elasticsearch . search . SearchParseException ( context , ( ( ( ( ( ( "Unknown<seq2seq4repair_space>key<seq2seq4repair_space>for<seq2seq4repair_space>a<seq2seq4repair_space>" + token ) + "<seq2seq4repair_space>in<seq2seq4repair_space>aggregation<seq2seq4repair_space>[" ) + aggregationName ) + "]:<seq2seq4repair_space>[" ) + currentFieldName ) + "]." ) ) ; } } else { throw new org . elasticsearch . search . SearchParseException ( context , ( ( ( ( "Unexpected<seq2seq4repair_space>token<seq2seq4repair_space>" + token ) + "<seq2seq4repair_space>in<seq2seq4repair_space>aggregation<seq2seq4repair_space>[" ) + aggregationName ) + "]." ) ) ; } } <START_BUG> if ( interval < 0 ) { <END_BUG> throw new org . elasticsearch . search . SearchParseException ( context , ( ( "Missing<seq2seq4repair_space>required<seq2seq4repair_space>field<seq2seq4repair_space>[interval]<seq2seq4repair_space>for<seq2seq4repair_space>histogram<seq2seq4repair_space>aggregation<seq2seq4repair_space>[" + aggregationName ) + "]" ) ) ; } Rounding rounding = new Rounding . Interval ( interval ) ; if ( ( preOffset != 0 ) || ( postOffset != 0 ) ) { rounding = new Rounding . PrePostRounding ( ( ( Rounding . Interval ) ( rounding ) ) , preOffset , postOffset ) ; } if ( extendedBounds != null ) { extendedBounds . processAndValidate ( aggregationName , context , RAW ) ; } return new HistogramAggregator . Factory ( aggregationName , vsParser . config ( ) , rounding , order , keyed , minDocCount , extendedBounds , InternalHistogram . FACTORY ) ; } static InternalOrder resolveOrder ( String key , boolean asc ) { } }

Fix:
if ( interval < 1 ) {