def _process_field(field: Field, rules, field_select, ret, prefix): schema_type = field['type'] if schema_type == 'array': field = copy(field) field['type'] = field['es:itemType'] return _process_field(field, rules, field_select, ret, prefix) enabled = field.get('es:index', True) and not field.get('es:exclude', False) subschema = {'fields': []} if enabled: if schema_type == 'object': subschema = field['es:schema'] _process_schema(subschema, rules, field_select, ret, prefix + field['name'] + '.') elif schema_type == 'string': search_field = prefix + field['name'] if field_select is None or search_field in field_select: for kind, suffix in rules(field): ret.append((kind, search_field + suffix))
def _process_field(field: Field, rules, ret, prefix): schema_type = field['type'] if schema_type == 'array': field = copy(field) field['type'] = field['es:itemType'] return _process_field(field, rules, ret, prefix) enabled = field.get('es:index', True) subschema = {'fields': []} if enabled and schema_type == 'object': subschema = field['es:schema'] _process_schema(subschema, rules, ret, prefix + field['name'] + '.') elif schema_type == 'string': if field['name'] not in ('doc_id', ): search_field = prefix + field['name'] for suffix in rules.get( ('es:title' in field, 'es:keyword' in field), ['']): ret.append(search_field + suffix)