Clojure wrapper and sorting failure

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Clojure wrapper and sorting failure

Phil Hagelberg-2
We've been working on testing out Elastic Search in our Clojure
project. We started out using the HTTP API, but then we realized there
could be some serious advantages to an in-process server as offered by
the Java API after kimchy suggested it.

He also suggested a Clojure wrapper might be useful to have public, so
I've extracted what we've been using so far. It's very immature and
only covers the basics of what we've needed it for so far (query
functions are not used in production; they're only used in the tests
to ensure that indexing has succeeded.)

Anyway, during this process we ran into an issue with sorting. Sorting
on certain fields causes the results returned to be empty even though
fetching the documents one-by-one confirms that they all contain that
field, and it's clear from the mapping that it's indexed with
"not_analyzed". This seems to be specific to the Java API as queries
made over HTTP did not have this limitation. But it's possible that
something else changed in the translation between HTTP and Java, so
that's just a theory.

My wrapper includes a test case to show the problem I'm describing:

To use it you'll need to install Leiningen, the Clojure build tool,
but this is easy:

$ cd ~/bin && wget
$ chmod 755 lein
$ lein self-install

Then go to the elasticsearch-clj checkout, type "lein deps" and "lein test".

Let me know if you have any problems reproducing or if I can explain
the issue more clearly.