Skip to content

Commit

Permalink
Update to ES 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Linn committed Feb 12, 2014
1 parent de535c2 commit 2f279f9
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ install: "pip install -r requirements.txt --use-mirrors"
# set up environment variables
env:
global:
- ES_VER=1.0.0.RC2
- ES_VER=1.0.0
- ES_MAPPER_ATTACHMENTS_VER=2.0.0.RC1
- ES_TRANSPORT_THRIFT_VER=2.0.0.RC1
- ES_RABBITMQ_PLUGIN_VER=2.0.0.RC1
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Documentation can be found `here <https://pylastica.readthedocs.org>`_.
Compatibility
-------------

Pylastica is tested with Python 2.7 and Elasticsearch version 1.0.0.RC2.
Pylastica is tested with Python 2.7 and Elasticsearch version 1.0.0.

Changes
-------
Expand Down
3 changes: 3 additions & 0 deletions changes.markdown
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Changelog
=========
### 2014-02-12
* Update to Elasticsearch 1.0.0

### 2014-02-03
* Update to Elasticsearch 1.0.0.RC2
* Update GeohashGrid aggregation to reflect name change
Expand Down
10 changes: 10 additions & 0 deletions pylastica/aggregation/iprange.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@


class IpRange(abstract.AbstractAggregation):
def __init__(self, name, field):
"""
@param name: the name of this aggregation
@type name: str
@param field: the name of the document field on which to perform this aggregation
@type field: str
"""
super(IpRange, self).__init__(name)
self.set_field(field)

def set_field(self, field):
"""
Set the field for this aggregation
Expand Down
10 changes: 10 additions & 0 deletions pylastica/aggregation/missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@


class Missing(abstract.AbstractAggregation):
def __init__(self, name, field):
"""
@param name: the name of this aggregation
@type name: str
@param field: the name of the document field on which to perform this aggregation
@type field: str
"""
super(Missing, self).__init__(name)
self.set_field(field)

def set_field(self, field):
"""
Set the field for this aggregation
Expand Down
10 changes: 10 additions & 0 deletions pylastica/aggregation/nested.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@


class Nested(abstract.AbstractAggregation):
def __init__(self, name, path):
"""
@param name: the name of this aggregation
@type name: str
@param path: the nested path for this aggregation
@type path: str
"""
super(Nested, self).__init__(name)
self.set_path(path)

def set_path(self, path):
"""
Set the nested path for this aggregation
Expand Down
10 changes: 10 additions & 0 deletions pylastica/aggregation/valuecount.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@


class ValueCount(abstract.AbstractAggregation):
def __init__(self, name, field):
"""
@param name: the name of this aggregation
@type name: str
@param field: the name of the document field on which to perform this aggregation
@type field: str
"""
super(ValueCount, self).__init__(name)
self.set_field(field)

def set_field(self, field):
"""
Set the field for this aggregation
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name='pylastica',
version='1.0.0.RC1',
version='1.0.0.0',
packages=packages,
url='https://github.com/jlinn/pylastica',
license='LICENSE.txt',
Expand Down
2 changes: 1 addition & 1 deletion tests/aggregation/test_daterange.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_date_range_aggregation(self):
query.add_aggregation(agg)
results = self._index.search(query).aggregations['date']

for bucket in results:
for bucket in results['buckets']:
if 'to' in bucket:
self.assertEqual(1, bucket['doc_count'])
elif 'from' in bucket:
Expand Down
2 changes: 1 addition & 1 deletion tests/aggregation/test_geohashgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class GeohashgridTest(unittest.TestCase, Base):
def setUp(self):
super(GeohashgridTest, self).setUp()
self._index = self._create_index("test_aggregation_geo_distance")
self._index = self._create_index("test_aggregation_geohash_grid")
mapping = Mapping()
mapping.set_properties({
"location": {"type": "geo_point"}
Expand Down
2 changes: 1 addition & 1 deletion tests/aggregation/test_iprange.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def tearDown(self):
self._index.delete()

def test_ip_range_aggregation(self):
agg = IpRange("ip").set_field("address")
agg = IpRange("ip", "address")
agg.add_range(from_value="192.168.1.101").add_range(to_value="192.168.1.200").add_mask_range("192.168.1.0/24")

query = Query()
Expand Down
8 changes: 4 additions & 4 deletions tests/aggregation/test_max.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import unittest


class MinTest(unittest.TestCase, Base):
class MaxTest(unittest.TestCase, Base):
def setUp(self):
super(MinTest, self).setUp()
super(MaxTest, self).setUp()
self._index = self._create_index("test_aggregation_max")
docs = [
Document("1", {"price": 5}),
Expand All @@ -23,7 +23,7 @@ def setUp(self):
self._index.refresh()

def tearDown(self):
super(MinTest, self).tearDown()
super(MaxTest, self).tearDown()
self._index.delete()

def test_to_dict(self):
Expand All @@ -45,7 +45,7 @@ def test_to_dict(self):
agg.add_aggregation(Max("subagg").set_field("foo"))
self.assertEqual(expected, agg.to_dict())

def test_min_aggregation(self):
def test_max_aggregation(self):
agg = Max("min_price")
agg.set_field("price")

Expand Down
2 changes: 1 addition & 1 deletion tests/aggregation/test_missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def tearDown(self):
self._index.delete()

def test_missing_aggregation(self):
agg = Missing("missing").set_field("color")
agg = Missing("missing", "color")

query = Query()
query.add_aggregation(agg)
Expand Down
2 changes: 1 addition & 1 deletion tests/aggregation/test_nested.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def tearDown(self):
self._index.delete()

def test_nested_aggregation(self):
agg = Nested("resellers").set_path("resellers")
agg = Nested("resellers", "resellers")
agg.add_aggregation(Min("min_price").set_field("price"))

query = Query()
Expand Down
3 changes: 1 addition & 2 deletions tests/aggregation/test_valuecount.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ def tearDown(self):
self._index.delete()

def test_value_count_aggregation(self):
agg = ValueCount("count")
agg.set_field("price")
agg = ValueCount("count", "price")

query = Query()
query.add_aggregation(agg)
Expand Down

0 comments on commit 2f279f9

Please sign in to comment.