This commit is contained in:
Andy McKay 2012-03-05 14:35:57 -08:00
Родитель aa4b41ea78
Коммит 1cb861445e
2 изменённых файлов: 19 добавлений и 0 удалений

Просмотреть файл

@ -117,3 +117,20 @@ def setup_indexes():
es.create_index_if_missing(index)
except pyes.ElasticSearchException:
pass
mapping = {
'properties': {
'id': {'type': 'long'},
'count': {'type': 'long'},
'data': {'dynamic': 'true',
'properties': {
'v': {'type': 'long'},
'k': {'type': 'string'}
}
},
'date': {'format':'dateOptionalTime',
'type':'date'}
}
}
es.put_mapping(CollectionCount._meta.db_table, mapping,
CollectionCount._get_index())

Просмотреть файл

@ -45,6 +45,7 @@ from bandwagon.models import Collection
from compat.models import AppCompat
from devhub.models import ActivityLog
from files.models import Approval, File
import stats
from versions.compare import version_int as vint
from versions.models import Version
from zadmin.forms import SiteEventForm
@ -541,6 +542,7 @@ def elastic(request):
es.delete_index_if_exists(INDEX)
# We must set up the mappings before we create the index again.
addons.search.setup_mapping()
stats.search.setup_indexes()
es.create_index_if_missing(INDEX)
messages.info(request, 'Deleting %s index.' % INDEX)
if request.POST.get('reindex') in mappings: