def index(advice):
topics = []<EOL>for topic in advice.topics:<EOL><INDENT>topics.append(topic)<EOL>parts = topic.split('<STR_LIT:/>')<EOL>if len(parts) > <NUM_LIT:1>:<EOL><INDENT>topics.append(parts[<NUM_LIT:0>])<EOL><DEDENT><DEDENT>try:<EOL><INDENT>es.index(index=es.index_name, doc_type=DOCTYPE, id=advice.id, body={<EOL>'<STR_LIT:id>': advice.id,<EOL>'<STR_LIT>': advice.administration,<EOL>'<STR_LIT:type>': advice.type,<EOL>'<STR_LIT>': advice.session.strftime('<STR_LIT>'),<EOL>'<STR_LIT>': advice.subject,<EOL>'<STR_LIT>': topics,<EOL>'<STR_LIT>': advice.tags,<EOL>'<STR_LIT>': advice.meanings,<EOL>'<STR_LIT>': advice.part,<EOL>'<STR_LIT:content>': advice.content,<EOL>})<EOL><DEDENT>except Exception:<EOL><INDENT>log.exception('<STR_LIT>', advice.id)<EOL><DEDENT>
Index/Reindex a CADA advice