# Clojure wrapper and sorting failure

**URL:** <https://discuss.elastic.co/t/clojure-wrapper-and-sorting-failure/2914>\
**Category:** Elasticsearch\
**Created:** [April 16, 2010, 6:43pm UTC](https://discuss.elastic.co/t/clojure-wrapper-and-sorting-failure/2914 "2010-04-16T18:43:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phil\_Hagelberg\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/phil_hagelberg_2/32/3344_2.png) [@Phil\_Hagelberg\_2](https://discuss.elastic.co/u/Phil_Hagelberg_2)\
**Post date:** [April 16, 2010, 6:43pm UTC](https://discuss.elastic.co/t/clojure-wrapper-and-sorting-failure/2914/1 "2010-04-16T18:43:08Z")

</div>

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:

[http://github.com/technomancy/elasticsearch-clj](http://github.com/technomancy/elasticsearch-clj)

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

$ cd ~/bin && wget [http://github.com/technomancy/leiningen/raw/stable/bin/lein](http://github.com/technomancy/leiningen/raw/stable/bin/lein)  
$ 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.

Thanks,  
Phil

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 4:24am UTC](https://discuss.elastic.co/t/clojure-wrapper-and-sorting-failure/2914/2 "2017-07-06T04:24:34Z")

</div>

Closed on July 6, 2017, 4:24am UTC


