Skip to content

Instantly share code, notes, and snippets.

@veriojon
Created August 3, 2011 14:24
Show Gist options
  • Save veriojon/1122758 to your computer and use it in GitHub Desktop.
Save veriojon/1122758 to your computer and use it in GitHub Desktop.
In [2]: from imata.libs.elastic_search import SearchEngine
In [3]: SearchEngine.reindex()
2011-08-03 10:22:24,744 INFO [urllib3.connectionpool][MainThread] Starting new HTTP connection (1): localhost
Rebuilding ES index, please wait.
/Users/jon/Env/lib/python2.7/site-packages/sqlalchemy/engine/default.py:518: SAWarning: Unicode type received non-unicode bind param value.
param[key.encode(encoding)] = processors[key](compiled_params[key])
Indexing 6, 8 assets.
Indexing 7, 9 assets.
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (11, 0))
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/Users/jon/Code/imata/<ipython console> in <module>()
/Users/jon/Code/imata/imata/libs/elastic_search.pyc in reindex(self)
57 projects = db.query(Project).all()
58 for project in projects:
---> 59 self.update_type("/project_%d" % project.id, project.field_definitions)
60 asset_ids = [a.id for a in db.query(Asset.id).filter(Asset.status != PublicationStatus.deleted).filter(Asset.project_id==project.id).all()]
61 print "Indexing %s, %d assets." % (project.id, len(asset_ids))
/Users/jon/Code/imata/imata/libs/elastic_search.pyc in update_type(self, index, field_definitions)
105 properties[fd.identifier] = dict(type="string", index="not_analyzed")
106 else:
--> 107 raise ValueError("Unexpected search type")
108 self.pool.urlopen("PUT", "%s" % index)
109 self.pool.urlopen("PUT", "%s/assets/_mapping" % index, json.dumps({"assets" : {"properties" : properties}}))
ValueError: Unexpected search type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment