incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Newson <rnew...@apache.org>
Subject Re: Cloaking calls to external API (ElasticSearch)
Date Wed, 25 Apr 2012 13:20:59 GMT
Hi Ian,

I found your question perfectly clear (though I may have been the only
one). The way to achieve this is as I described, write a new external
handler and add it to couchdb. For comparison, couchdb-lucene uses a
Python script (https://github.com/rnewson/couchdb-lucene/blob/master/couchdb-external-hook.py)
for this purpose.

When you POST to couchdb at hostname:port/dbname/_fti the body is
passed to the script, and you can then do whatever you like. In my
case, and yours, this is to transform the input into a query to an
external HTTP service. In my case, couchdb-lucene. In yours,
ElasticSearch.

B.

On 25 April 2012 14:14, Ian Mayo <ian@planetmayo.com> wrote:
> It appears my question could have been more clear.  Sorry about that -
> I'm unfamiliar with some of the language/terms used in CouchDb/REST.
>
> I have two servers.  One running a CouchDb database.  The other runs
> an ElasticServer [ES] database, which automatically indexed the
> CouchDb documents.
>
> ES is queried by collating a JSON search object, and passing that in a
> GET to the search URI.
>
> I'd like to tidy this architecture in two ways:
> 1)  Make it appear I'm just using the CouchDb database.
> 2)  Allow search query to be expressed purely in a URI
>
> So, I'd like to introduce a capability in CouchDb to handle (redirect)
> the search call - solving 1).  I'd also like this capability to be
> able to parse the URI parameters and produce a JSON search object, as
> shown in the initial message.
>
> I have a suspicion that I may be able to provide this capability in an
> _attachment - though I welcome any feedback/correction/clarification.
>
> cheers,
> Ian

Mime
View raw message