Add custom field indexing

add custom field indexing, already merged 2.2.0 from paris upstream.