public Mapping filter ( Collection < String > includes , Collection < String > excludes ) { if ( includes . isEmpty ( ) && excludes . isEmpty ( ) ) { return this ; } List < Field > filtered = new ArrayList < Field > ( ) ; List < FieldFilter . NumberedInclude > convertedIncludes = FieldFilter . toNumberedFilter ( includes ) ; boolean intact = true ; for ( Field fl : this . getFields ( ) ) { intact &= filterField ( fl , null , filtered , convertedIncludes , excludes ) ; } return ( intact ? this : new Mapping ( this . getIndex ( ) , this . getType ( ) , filtered ) ) ; }
Filters out fields based on the provided include and exclude information and returns a Mapping object