Exemplo n.º 1
0
# connection object to use for the save operations
conn = esprit.raw.Connection(host=settings.ELASTIC_SEARCH_HOST, index=settings.ELASTIC_SEARCH_DB)

# index all the songs
#####################

for sid in song_ids:
    song = Song().get(sid, links=True, host=settings.ELASTIC_SEARCH_HOST, index=settings.ELASTIC_SEARCH_DB)
    si = SongIndex.from_song(song)
    si.save(conn=conn)

# index all the singers
#######################

for sid in singer_ids:
    singer = Singer().get(sid, links=True, host=settings.ELASTIC_SEARCH_HOST, index=settings.ELASTIC_SEARCH_DB)
    si = SingerIndex.from_singer(singer)
    si.save(conn=conn)

# index all the versions
########################

for vid in version_ids:
    version = Version().get(vid, links=True, host=settings.ELASTIC_SEARCH_HOST, index=settings.ELASTIC_SEARCH_DB)
    vi = VersionIndex.from_version(version)
    vi.save(conn=conn)