diff --git a/Vagrantfile b/Vagrantfile index 85c7e6c..2c13a71 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -8,7 +8,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "precise32" config.vm.network :private_network, ip: "192.168.33.101" - config.vm.network "forwarded_port", guest: 9200, host: 9220 + config.vm.network "forwarded_port", guest: 9200, host: 9200 config.vm.provider :virtualbox do |v, override| override.vm.box_url = "http://files.vagrantup.com/precise32.box" diff --git a/elastimorphic/__init__.py b/elastimorphic/__init__.py index 9869aae..df89ca7 100644 --- a/elastimorphic/__init__.py +++ b/elastimorphic/__init__.py @@ -1,4 +1,4 @@ from .base import Indexable, PolymorphicIndexable, SearchManager # noqa -__version__ = "0.1.0" +__version__ = "0.1.1" __all__ = [PolymorphicIndexable, SearchManager] diff --git a/elastimorphic/management/commands/backup_settings.py b/elastimorphic/management/commands/backup_settings.py deleted file mode 100644 index 25d10c1..0000000 --- a/elastimorphic/management/commands/backup_settings.py +++ /dev/null @@ -1,32 +0,0 @@ -import json - -from django.core.management.base import BaseCommand -from elasticutils import get_es - -from elastimorphic.conf import settings -from elastimorphic.models import polymorphic_indexable_registry - - -class Command(BaseCommand): - help = "Dump the indexable settings and mappings to a bash script" - - def handle(self, **options): - es = get_es(urls=settings.ES_URLS) - - self.stdout.write("#!/bin/bash") - self.stdout.write("ES_HOST=$1") - - aliases = es.aliases() - for index_name in aliases: - index_aliases = aliases[index_name]["aliases"] - if index_aliases: - index_alias = index_aliases.keys()[0] - self.stdout.write("curl -XPUT http://$ES_HOST:9200/%s -d '%s'" % (index_name, json.dumps(settings.ES_SETTINGS))) - self.stdout.write('curl -XPOST http://$ES_HOST:9200/_aliases -d \'{"actions": [{"add": {"index": "%s", "alias": "%s"}}]}\'' % (index_name, index_alias)) - - for name, model in polymorphic_indexable_registry.all_models.items(): - self.stdout.write("curl -XPUT http://$ES_HOST:9200/%s/%s/_mapping -d '%s'" % ( - model.get_index_name(), - model.get_mapping_type_name(), - json.dumps(model.get_mapping()) - )) diff --git a/elastimorphic/management/commands/bulk_index.py b/elastimorphic/management/commands/bulk_index.py index 92a7de3..924e98c 100644 --- a/elastimorphic/management/commands/bulk_index.py +++ b/elastimorphic/management/commands/bulk_index.py @@ -80,7 +80,7 @@ def handle(self, *args, **options): good_items = [item for item in response["items"] if item["index"].get("ok", False)] if len(good_items) != len(payload) // 2: self.stdout.write("Bulk indexing error! Item count mismatch.") - bad_items = [item for item in response["items"] if not item["index"].get("ok", False)] + bad_items = [item for item in response["items"] if item["index"].get["status"] < 201] self.stdout.write("These were rejected: %s" % str(bad_items)) return "Bulk indexing failed." num_processed += (len(payload) / 2)