crunch-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Josh Wills <jwi...@cloudera.com>
Subject Re: Crunch integration with ElasticSearch
Date Mon, 08 Apr 2013 05:18:11 GMT
Hey Christian,

Supe-cool. Replies inlined.

On Sun, Apr 7, 2013 at 8:32 PM, Christian Tzolov <christian.tzolov@gmail.com
> wrote:

> I've been working on Crunch - ElasticSearch (http://www.elasticsearch.org/
> )
>  integration over the weekend :)
>
> Here is my first prototype:
> https://github.com/tzolov/elasticsearch-hadoop#crunch and a sample
> application: http://bit.ly/Y7lasW.
>
> It implements ES Source and Target on top of the ES-Hadoop's (
> https://github.com/elasticsearch/elasticsearch-hadoop) ESInputFormat and
> ESOutputFormat.
>
> Not sure though what is the best/right way to build Source/Targets for new
> Input/Output Formats? Any suggestions, references?
>

I built a Source for HCatalog last week as part of ML:

https://github.com/cloudera/ml/blob/master/hcatalog/src/main/java/com/cloudera/science/ml/hcatalog/HCatalogSource.java

The interesting bit is really in the configureSource method: if the inputId
is < 0, then it's a single-input MapReduce job, and you can essentially
configure the input just as you would for a regular MapReduce. If the
inputId >= 0, then it's a multi-input job (e.g., for a join), and you have
to use CrunchInputs w/a FormatBundle object. The FormatBundle wraps an
InputFormat or an OutputFormat w/any Configuration settings that the
InputFormat/OutputFormat needs. This way, you can have multiple inputs that
use the same InputFormat, but have different configuration settings (e.g.,
when you're joining multiple Avro files together and they each need to have
their own schema specified.)



> The write to ES is tricky and at the moment looks more like a hack (see the
> doc).
>
> Cheers
> Chris
>
> (P.S The prototype doesn't support AvroTypeFamily yet but I've been looking
> at jackson-dataformat-avro kind of solution (ES-Hadoop relies on Jackson
> for the JSON serialisation)
>

I'd like to work on this as well-- I'll take a look tomorrow and try to put
together a pull req for anything that I think should be configured
differently.

J



-- 
Director of Data Science
Cloudera <http://www.cloudera.com>
Twitter: @josh_wills <http://twitter.com/josh_wills>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message