Permalink
Browse files

added thrift support

  • Loading branch information...
1 parent 0dc3fb8 commit 37f0ee528778b1863a584844dff888217982d819 Alberto Paro committed Sep 10, 2010
View
@@ -1,7 +1,7 @@
Installing pyes
=================
-You can install ``pyes`` either via the Python Package Index (PyPI)
+You can install ``pyes`` either via the Python Package Index (PyPI)
or from source.
To install using ``pip``,::
@@ -13,7 +13,7 @@ To install using ``easy_install``,::
$ easy_install pyes
If you have downloaded a source tarball you can install it
-by doing the following,::
+by doing the following::
$ python setup.py build
# python setup.py install # as root
View
@@ -1 +0,0 @@
-README.rst
View
View
72 README.rst 100644 → 100755
@@ -2,11 +2,9 @@
pyes - Python ElasticSearch
=============================
-.. image:: pyes_favicon_128.png
-
:Version: 0.1.0
-:Web: http://pypi.python.org/pypi/pyes/
-:Download: http://pypi.python.org/pypi/pyes/
+#:Web: http://pypi.python.org/pypi/pyes/
+#:Download: http://pypi.python.org/pypi/pyes/
:Source: http://github.com/aparo/pyes/
:Keywords: search, elastisearch, distribute search
@@ -16,11 +14,73 @@ pyes is a connector to use elasticsearch from python.
For now it is in alpha state, but working.
+Usage
+=====
+
+::
+ from pyes import *
+
+ conn = ElasticSearch('http://127.0.0.1:9200/')
+ try:
+ conn.delete_index("test-index")
+ except:
+ pass
+
+ mapping = { u'parsedtext': {'boost': 1.0,
+ 'index': 'analyzed',
+ 'store': 'yes',
+ 'type': u'string',
+ "term_vector" : "with_positions_offsets"},
+ u'name': {'boost': 1.0,
+ 'index': 'analyzed',
+ 'store': 'yes',
+ 'type': u'string',
+ "term_vector" : "with_positions_offsets"},
+ u'title': {'boost': 1.0,
+ 'index': 'analyzed',
+ 'store': 'yes',
+ 'type': u'string',
+ "term_vector" : "with_positions_offsets"},
+ u'pos': {'store': 'yes',
+ 'type': u'integer'},
+ u'uuid': {'boost': 1.0,
+ 'index': 'not_analyzed',
+ 'store': 'yes',
+ 'type': u'string'}}
+ conn.create_index("test-index")
+ conn.put_mapping("test-type", {'properties':mapping}, ["test-index"])
+ conn.index({"name":"Joe Tester", "parsedtext":"Joe Testere nice guy", "uuid":"11111", "position":1}, "test-index", "test-type", 1)
+ conn.index({"name":"Bill Baloney", "parsedtext":"Joe Testere nice guy", "uuid":"22222", "position":2}, "test-index", "test-type", 2)
+ conn.refresh(["test-index"])
+
+ q = TermQuery("name", "joe")
+ result = self.conn.search(query = q)
+ if result['hits']['total'] == 1:
+ print "ok"
+ else:
+ print "No results"
+
+
+For more examples looks at the tests.
+
+
+TODO
+----
+
+- connection pool
+- multiprocess for indexing
+- API rewriting for indexing and mapping part
+- more docs
+- more tests
+- facets
+- cleanup
+
+
+
License
=======
This software is licensed under the ``New BSD License``. See the ``LICENSE``
file in the top distribution directory for the full license text.
-.. # vim: syntax=rst expandtab tabstop=4 shiftwidth=4 shiftround
-
+.. # vim: syntax=rst expandtab tabstop=4 shiftwidth=4 shiftround
View
@@ -1,2 +1,2 @@
-Thanks to lukasvlcek and kimchy.
+Thanks to kimchy and lukasvlcek.
Oops, something went wrong.

0 comments on commit 37f0ee5

Please sign in to comment.