# Elasticsearch-hadoop - getting specified fields from elasticsearch as an input to a mapreduce job

**URL:** <https://discuss.elastic.co/t/elasticsearch-hadoop-getting-specified-fields-from-elasticsearch-as-an-input-to-a-mapreduce-job/21026>\
**Category:** Elasticsearch\
**Created:** [December 2, 2014, 10:52am UTC](https://discuss.elastic.co/t/elasticsearch-hadoop-getting-specified-fields-from-elasticsearch-as-an-input-to-a-mapreduce-job/21026 "2014-12-02T10:52:02Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![eliasah](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eliasah/32/34741_2.png) [@eliasah](https://discuss.elastic.co/u/eliasah)\
**Post date:** [December 2, 2014, 10:52am UTC](https://discuss.elastic.co/t/elasticsearch-hadoop-getting-specified-fields-from-elasticsearch-as-an-input-to-a-mapreduce-job/21026/1 "2014-12-02T10:52:02Z")

</div>

I'm trying to write a mapreduce job where I can query elasticsearch so it  
can return to me specific fields. Is there any way to do that?

My mapping contains about 30 fields and I will need just 4 of them  
("\_id","title","description","category")

The way I was doing it is to process each answer to get those fields, but  
I'm looking for a cleaner way to do that.

Any help or suggestion is appreciated.

Thanks!

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![costin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/costin/32/44950_2.png) [@costin](https://discuss.elastic.co/u/costin)\
**Post date:** [December 2, 2014, 11:36am UTC](https://discuss.elastic.co/t/elasticsearch-hadoop-getting-specified-fields-from-elasticsearch-as-an-input-to-a-mapreduce-job/21026/2 "2014-12-02T11:36:27Z")

</div>

Simply specify the fields that you are interested in, in the query and you are good to go.

[1] [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html)

On 12/2/14 12:52 PM, Elias Abou Haydar wrote:

> I'm trying to write a mapreduce job where I can query elasticsearch so it can return to me specific fields. Is there any  
> way to do that?
> 
> My mapping contains about 30 fields and I will need just 4 of them ("\_id","title","description","category")
> 
> The way I was doing it is to process each answer to get those fields, but I'm looking for a cleaner way to do that.
> 
> Any help or suggestion is appreciated.
> 
> Thanks!
> 
> --  
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com) [mailto:elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Costin

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/547DA43B.4020305%40gmail.com](https://groups.google.com/d/msgid/elasticsearch/547DA43B.4020305%40gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![eliasah](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eliasah/32/34741_2.png) [@eliasah](https://discuss.elastic.co/u/eliasah)\
**Post date:** [December 3, 2014, 1:04pm UTC](https://discuss.elastic.co/t/elasticsearch-hadoop-getting-specified-fields-from-elasticsearch-as-an-input-to-a-mapreduce-job/21026/3 "2014-12-03T13:04:59Z")

</div>

That works fine for me thank you! But I'd also wanted to be able to build  
and object from the MapWritable values in the mapper.

Consider values as MapWritable object.  
When I try to get a specified value from values.get("title") per example  
the returning value is null but the field exists in the values.keySet()

Considering the following code :

System.out.println(values.keySet());  
System.out.println(values.toString());  
System.out.println("title : " + values.get("title"));  
System.out.println("category : " + values.get("category"));

This is a snippet from the debug output :

[title, categoryId]  
{title=[Samsung EF-CI950BCEGWW S View], categoryId=[3485]}  
title : null  
category : null

Thanks again!

Le mardi 2 décembre 2014 12:36:57 UTC+1, Costin Leau a écrit :

> Simply specify the fields that you are interested in, in the query and you  
> are good to go.
> 
> [1]  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html)
> 
> On 12/2/14 12:52 PM, Elias Abou Haydar wrote:
> 
> > I'm trying to write a mapreduce job where I can query elasticsearch so  
> > it can return to me specific fields. Is there any  
> > way to do that?
> > 
> > My mapping contains about 30 fields and I will need just 4 of them  
> > ("\_id","title","description","category")
> > 
> > The way I was doing it is to process each answer to get those fields,  
> > but I'm looking for a cleaner way to do that.
> > 
> > Any help or suggestion is appreciated.
> > 
> > Thanks!
> > 
> > --  
> > You received this message because you are subscribed to the Google  
> > Groups "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send  
> > an email to  
> > [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\> \<mailto:  
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com) \<javascript:\>\>.  
> > To view this discussion on the web visit
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com)
> 
> > \<  
> > [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer)\>.
> 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Costin

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![costin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/costin/32/44950_2.png) [@costin](https://discuss.elastic.co/u/costin)\
**Post date:** [December 3, 2014, 1:09pm UTC](https://discuss.elastic.co/t/elasticsearch-hadoop-getting-specified-fields-from-elasticsearch-as-an-input-to-a-mapreduce-job/21026/4 "2014-12-03T13:09:55Z")

</div>

That's because your MapWritables doesn't use Strings as keys but rather org.apache.hadoop.io.Text  
In other words, you can see the data is in the map however you cannot retrieve it since you are using the wrong key (try  
inspecting the map object types).

Try values.get(new Text("title"))

On 12/3/14 3:04 PM, Elias Abou Haydar wrote:

> That works fine for me thank you! But I'd also wanted to be able to build and object from the MapWritable values in the  
> mapper.
> 
> Consider values as MapWritable object.  
> When I try to get a specified value from values.get("title") per example the returning value is null but the field  
> exists in the values.keySet()
> 
> Considering the following code :
> 
> System.out.println(values.keySet());  
> System.out.println(values.toString());  
> System.out.println("title : " + values.get("title"));  
> System.out.println("category : " + values.get("category"));
> 
> This is a snippet from the debug output :
> 
> [title, categoryId]  
> {title=[Samsung EF-CI950BCEGWW S View], categoryId=[3485]}  
> title : null  
> category : null
> 
> Thanks again!
> 
> Le mardi 2 décembre 2014 12:36:57 UTC+1, Costin Leau a écrit :
> 
> ```
> Simply specify the fields that you are interested in, in the query and you are good to go.
> 
> [1] http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html
> <http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html>
> 
> On 12/2/14 12:52 PM, Elias Abou Haydar wrote:
> > I'm trying to write a mapreduce job where I can query elasticsearch so it can return to me specific fields. Is there any
> > way to do that?
> >
> > My mapping contains about 30 fields and I will need just 4 of them ("_id","title","description","category")
> >
> > The way I was doing it is to process each answer to get those fields, but I'm looking for a cleaner way to do that.
> >
> > Any help or suggestion is appreciated.
> >
> > Thanks!
> >
> > --
> > You received this message because you are subscribed to the Google Groups "elasticsearch" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to
> >elasticsearc...@googlegroups.com <javascript:> <mailto:elasticsearch+unsubscribe@googlegroups.com <javascript:>>.
> > To view this discussion on the web visit
> >https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com>
> > <https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer>>.
> 
> > For more options, visithttps://groups.google.com/d/optout <https://groups.google.com/d/optout>.
> 
> --
> Costin
> 
> ```
> 
> --  
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com) [mailto:elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm_medium=email&utm_source=footer).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).  
> --  
> Costin

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/547F0BA3.4050603%40gmail.com](https://groups.google.com/d/msgid/elasticsearch/547F0BA3.4050603%40gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![eliasah](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eliasah/32/34741_2.png) [@eliasah](https://discuss.elastic.co/u/eliasah)\
**Post date:** [December 3, 2014, 1:30pm UTC](https://discuss.elastic.co/t/elasticsearch-hadoop-getting-specified-fields-from-elasticsearch-as-an-input-to-a-mapreduce-job/21026/5 "2014-12-03T13:30:48Z")

</div>

I've tried that. It returns a  
org.elasticsearch.hadoop.mr.WritableArrayWritable object. How can I get my  
field content out of that?

Le mercredi 3 décembre 2014 14:10:24 UTC+1, Costin Leau a écrit :

> That's because your MapWritables doesn't use Strings as keys but rather  
> org.apache.hadoop.io.Text  
> In other words, you can see the data is in the map however you cannot  
> retrieve it since you are using the wrong key (try  
> inspecting the map object types).
> 
> Try values.get(new Text("title"))
> 
> On 12/3/14 3:04 PM, Elias Abou Haydar wrote:
> 
> > That works fine for me thank you! But I'd also wanted to be able to  
> > build and object from the MapWritable values in the  
> > mapper.
> > 
> > Consider values as MapWritable object.  
> > When I try to get a specified value from values.get("title") per example  
> > the returning value is null but the field  
> > exists in the values.keySet()
> > 
> > Considering the following code :
> > 
> > System.out.println(values.keySet());  
> > System.out.println(values.toString());  
> > System.out.println("title : " + values.get("title"));  
> > System.out.println("category : " + values.get("category"));
> > 
> > This is a snippet from the debug output :
> > 
> > [title, categoryId]  
> > {title=[Samsung EF-CI950BCEGWW S View], categoryId=[3485]}  
> > title : null  
> > category : null
> > 
> > Thanks again!
> > 
> > Le mardi 2 décembre 2014 12:36:57 UTC+1, Costin Leau a écrit :
> > 
> > ```
> > Simply specify the fields that you are interested in, in the query 
> > 
> > ```
> 
> and you are good to go.
> 
> > ```
> > [1] 
> > 
> > ```
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html)
> 
> > ```
> > <
> > 
> > ```
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html)\>
> 
> > ```
> > On 12/2/14 12:52 PM, Elias Abou Haydar wrote: 
> > > I'm trying to write a mapreduce job where I can query 
> > 
> > ```
> 
> elasticsearch so it can return to me specific fields. Is there any
> 
> > ```
> > > way to do that? 
> > > 
> > > My mapping contains about 30 fields and I will need just 4 of them 
> > 
> > ```
> 
> ("\_id","title","description","category")
> 
> > ```
> > > 
> > > The way I was doing it is to process each answer to get those 
> > 
> > ```
> 
> fields, but I'm looking for a cleaner way to do that.
> 
> > ```
> > > 
> > > Any help or suggestion is appreciated. 
> > > 
> > > Thanks! 
> > > 
> > > -- 
> > > You received this message because you are subscribed to the Google 
> > 
> > ```
> 
> Groups "elasticsearch" group.
> 
> > ```
> > > To unsubscribe from this group and stop receiving emails from it, 
> > 
> > ```
> 
> send an email to
> 
> > ```
> > >elasticsearc...@googlegroups.com <javascript:> <mailto:
> > 
> > ```
> 
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com) \<javascript:\> \<javascript:\>\>.
> 
> > ```
> > > To view this discussion on the web visit 
> > >
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com)\>
> 
> > ```
> > > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer)\>\>.
> 
> > ```
> > > For more options, visithttps://groups.google.com/d/optout <
> > 
> > ```
> 
> [https://groups.google.com/d/optout](https://groups.google.com/d/optout)\>.
> 
> > ```
> > -- 
> > Costin 
> > 
> > ```
> > 
> > --  
> > You received this message because you are subscribed to the Google  
> > Groups "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send  
> > an email to  
> > [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\> \<mailto:  
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com) \<javascript:\>\>.  
> > To view this discussion on the web visit
> 
> [https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com)
> 
> > \<  
> > [https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm_medium=email&utm_source=footer)\>.
> 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).  
> > --  
> > Costin

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![costin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/costin/32/44950_2.png) [@costin](https://discuss.elastic.co/u/costin)\
**Post date:** [December 3, 2014, 3:21pm UTC](https://discuss.elastic.co/t/elasticsearch-hadoop-getting-specified-fields-from-elasticsearch-as-an-input-to-a-mapreduce-job/21026/6 "2014-12-03T15:21:14Z")

</div>

You're getting back an array ([Samsung EF-C....]) - a Writable wrapper around org.hadoop.io.ArrayWritable (to actually  
allow it to be serialized).  
So call toStrings() or get() to get its content.

On 12/3/14 3:30 PM, Elias Abou Haydar wrote:

> I've tried that. It returns a org.elasticsearch.hadoop.mr.WritableArrayWritable object. How can I get my field content  
> out of that?
> 
> Le mercredi 3 décembre 2014 14:10:24 UTC+1, Costin Leau a écrit :
> 
> ```
> That's because your MapWritables doesn't use Strings as keys but rather org.apache.hadoop.io.Text
> In other words, you can see the data is in the map however you cannot retrieve it since you are using the wrong key
> (try
> inspecting the map object types).
> 
> Try values.get(new Text("title"))
> 
> On 12/3/14 3:04 PM, Elias Abou Haydar wrote:
> > That works fine for me thank you! But I'd also wanted to be able to build and object from the MapWritable values in the
> > mapper.
> >
> > Consider values as MapWritable object.
> > When I try to get a specified value from values.get("title") per example the returning value is null but the field
> > exists in the values.keySet()
> >
> > Considering the following code :
> >
> > System.out.println(values.keySet());
> > System.out.println(values.toString());
> > System.out.println("title : " + values.get("title"));
> > System.out.println("category : " + values.get("category"));
> >
> > This is a snippet from the debug output :
> >
> > [title, categoryId]
> > {title=[Samsung EF-CI950BCEGWW S View], categoryId=[3485]}
> > title : null
> > category : null
> >
> > Thanks again!
> >
> > Le mardi 2 décembre 2014 12:36:57 UTC+1, Costin Leau a écrit :
> >
> > Simply specify the fields that you are interested in, in the query and you are good to go.
> >
> > [1]http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html
> <http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html>
> > <http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html
> <http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html>>
> >
> > On 12/2/14 12:52 PM, Elias Abou Haydar wrote:
> > > I'm trying to write a mapreduce job where I can query elasticsearch so it can return to me specific fields. Is there any
> > > way to do that?
> > >
> > > My mapping contains about 30 fields and I will need just 4 of them ("_id","title","description","category")
> > >
> > > The way I was doing it is to process each answer to get those fields, but I'm looking for a cleaner way to do that.
> > >
> > > Any help or suggestion is appreciated.
> > >
> > > Thanks!
> > >
> > > --
> > > You received this message because you are subscribed to the Google Groups "elasticsearch" group.
> > > To unsubscribe from this group and stop receiving emails from it, send an email to
> > >elasticsearc...@googlegroups.com <javascript:> <mailto:elasticsearch+unsubscribe@googlegroups.com <javascript:>
> <javascript:>>.
> > > To view this discussion on the web visit
> > >https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com>
> > <https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com>>
> > > <https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer>
> 
> > <https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer>>>.
> 
> >
> > > For more options, visithttps://groups.google.com/d/optout <http://groups.google.com/d/optout> <https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>>.
> >
> > --
> > Costin
> >
> > --
> > You received this message because you are subscribed to the Google Groups "elasticsearch" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to
> >elasticsearc...@googlegroups.com <javascript:> <mailto:elasticsearch+unsubscribe@googlegroups.com <javascript:>>.
> > To view this discussion on the web visit
> >https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com>
> > <https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm_medium=email&utm_source=footer>>.
> 
> > For more options, visithttps://groups.google.com/d/optout <https://groups.google.com/d/optout>.
> --
> Costin
> 
> ```
> 
> --  
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com) [mailto:elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com?utm_medium=email&utm_source=footer).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Costin

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/547F2A6A.4040807%40gmail.com](https://groups.google.com/d/msgid/elasticsearch/547F2A6A.4040807%40gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![eliasah](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eliasah/32/34741_2.png) [@eliasah](https://discuss.elastic.co/u/eliasah)\
**Post date:** [December 3, 2014, 3:24pm UTC](https://discuss.elastic.co/t/elasticsearch-hadoop-getting-specified-fields-from-elasticsearch-as-an-input-to-a-mapreduce-job/21026/7 "2014-12-03T15:24:46Z")

</div>

I've already tried that. It doesn't work... 😕

Le mercredi 3 décembre 2014 16:21:40 UTC+1, Costin Leau a écrit :

> You're getting back an array ([Samsung EF-C....]) - a Writable wrapper  
> around org.hadoop.io.ArrayWritable (to actually  
> allow it to be serialized).  
> So call toStrings() or get() to get its content.
> 
> On 12/3/14 3:30 PM, Elias Abou Haydar wrote:
> 
> > I've tried that. It returns a  
> > org.elasticsearch.hadoop.mr.WritableArrayWritable object. How can I get my  
> > field content  
> > out of that?
> > 
> > Le mercredi 3 décembre 2014 14:10:24 UTC+1, Costin Leau a écrit :
> > 
> > ```
> > That's because your MapWritables doesn't use Strings as keys but 
> > 
> > ```
> 
> rather org.apache.hadoop.io.Text
> 
> > ```
> > In other words, you can see the data is in the map however you 
> > 
> > ```
> 
> cannot retrieve it since you are using the wrong key
> 
> > ```
> > (try 
> > inspecting the map object types). 
> > 
> > Try values.get(new Text("title")) 
> > 
> > On 12/3/14 3:04 PM, Elias Abou Haydar wrote: 
> > > That works fine for me thank you! But I'd also wanted to be able 
> > 
> > ```
> 
> to build and object from the MapWritable values in the
> 
> > ```
> > > mapper. 
> > > 
> > > Consider values as MapWritable object. 
> > > When I try to get a specified value from values.get("title") per 
> > 
> > ```
> 
> example the returning value is null but the field
> 
> > ```
> > > exists in the values.keySet() 
> > > 
> > > Considering the following code : 
> > > 
> > > System.out.println(values.keySet()); 
> > > System.out.println(values.toString()); 
> > > System.out.println("title : " + values.get("title")); 
> > > System.out.println("category : " + values.get("category")); 
> > > 
> > > This is a snippet from the debug output : 
> > > 
> > > [title, categoryId] 
> > > {title=[Samsung EF-CI950BCEGWW S View], categoryId=[3485]} 
> > > title : null 
> > > category : null 
> > > 
> > > Thanks again! 
> > > 
> > > Le mardi 2 décembre 2014 12:36:57 UTC+1, Costin Leau a écrit : 
> > > 
> > > Simply specify the fields that you are interested in, in the 
> > 
> > ```
> 
> query and you are good to go.
> 
> > ```
> > > 
> > > [1]
> > 
> > ```
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html)
> 
> > ```
> > <
> > 
> > ```
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html)\>
> 
> > ```
> > > <
> > 
> > ```
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html)
> 
> > ```
> > <
> > 
> > ```
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html)\>\>
> 
> > ```
> > > 
> > > On 12/2/14 12:52 PM, Elias Abou Haydar wrote: 
> > > > I'm trying to write a mapreduce job where I can query 
> > 
> > ```
> 
> elasticsearch so it can return to me specific fields. Is there any
> 
> > ```
> > > > way to do that? 
> > > > 
> > > > My mapping contains about 30 fields and I will need just 4 
> > 
> > ```
> 
> of them ("\_id","title","description","category")
> 
> > ```
> > > > 
> > > > The way I was doing it is to process each answer to get 
> > 
> > ```
> 
> those fields, but I'm looking for a cleaner way to do that.
> 
> > ```
> > > > 
> > > > Any help or suggestion is appreciated. 
> > > > 
> > > > Thanks! 
> > > > 
> > > > -- 
> > > > You received this message because you are subscribed to the 
> > 
> > ```
> 
> Google Groups "elasticsearch" group.
> 
> > ```
> > > > To unsubscribe from this group and stop receiving emails 
> > 
> > ```
> 
> from it, send an email to
> 
> > ```
> > > >elasticsearc...@googlegroups.com <javascript:> <mailto:
> > 
> > ```
> 
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com) \<javascript:\> \<javascript:\>
> 
> > ```
> > <javascript:>>. 
> > > > To view this discussion on the web visit 
> > > >
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com)\>
> 
> > ```
> > > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com)\>\>
> 
> > ```
> > > > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer)\>
> 
> > ```
> > > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer)\>\>\>.
> 
> > ```
> > > 
> > > > For more options, visithttps://groups.google.com/d/optout <
> > 
> > ```
> 
> [http://groups.google.com/d/optout](http://groups.google.com/d/optout)\> \<[https://groups.google.com/d/optout](https://groups.google.com/d/optout)
> 
> > ```
> > <https://groups.google.com/d/optout>>. 
> > > 
> > > -- 
> > > Costin 
> > > 
> > > -- 
> > > You received this message because you are subscribed to the Google 
> > 
> > ```
> 
> Groups "elasticsearch" group.
> 
> > ```
> > > To unsubscribe from this group and stop receiving emails from it, 
> > 
> > ```
> 
> send an email to
> 
> > ```
> > >elasticsearc...@googlegroups.com <javascript:> <mailto:
> > 
> > ```
> 
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com) \<javascript:\> \<javascript:\>\>.
> 
> > ```
> > > To view this discussion on the web visit 
> > >
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com)\>
> 
> > ```
> > > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm_medium=email&utm_source=footer)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm_medium=email&utm_source=footer)\>\>.
> 
> > ```
> > > For more options, visithttps://groups.google.com/d/optout <
> > 
> > ```
> 
> [https://groups.google.com/d/optout](https://groups.google.com/d/optout)\>.
> 
> > ```
> > -- 
> > Costin 
> > 
> > ```
> > 
> > --  
> > You received this message because you are subscribed to the Google  
> > Groups "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send  
> > an email to  
> > [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\> \<mailto:  
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com) \<javascript:\>\>.  
> > To view this discussion on the web visit
> 
> [https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com)
> 
> > \<  
> > [https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com?utm_medium=email&utm_source=footer)\>.
> 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Costin

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/e5aab47b-e04e-415b-9e61-c8f077ad1513%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e5aab47b-e04e-415b-9e61-c8f077ad1513%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![eliasah](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eliasah/32/34741_2.png) [@eliasah](https://discuss.elastic.co/u/eliasah)\
**Post date:** [December 3, 2014, 3:29pm UTC](https://discuss.elastic.co/t/elasticsearch-hadoop-getting-specified-fields-from-elasticsearch-as-an-input-to-a-mapreduce-job/21026/8 "2014-12-03T15:29:37Z")

</div>

I've tried to call toStrings()  
I got this :  
title : [Ljava.lang.String;@35112ff7

with the get(), i'm getting this:  
title : [Lorg.apache.hadoop.io.Writable;@666f5678

Le mercredi 3 décembre 2014 16:21:40 UTC+1, Costin Leau a écrit :

> You're getting back an array ([Samsung EF-C....]) - a Writable wrapper  
> around org.hadoop.io.ArrayWritable (to actually  
> allow it to be serialized).  
> So call toStrings() or get() to get its content.
> 
> On 12/3/14 3:30 PM, Elias Abou Haydar wrote:
> 
> > I've tried that. It returns a  
> > org.elasticsearch.hadoop.mr.WritableArrayWritable object. How can I get my  
> > field content  
> > out of that?
> > 
> > Le mercredi 3 décembre 2014 14:10:24 UTC+1, Costin Leau a écrit :
> > 
> > ```
> > That's because your MapWritables doesn't use Strings as keys but 
> > 
> > ```
> 
> rather org.apache.hadoop.io.Text
> 
> > ```
> > In other words, you can see the data is in the map however you 
> > 
> > ```
> 
> cannot retrieve it since you are using the wrong key
> 
> > ```
> > (try 
> > inspecting the map object types). 
> > 
> > Try values.get(new Text("title")) 
> > 
> > On 12/3/14 3:04 PM, Elias Abou Haydar wrote: 
> > > That works fine for me thank you! But I'd also wanted to be able 
> > 
> > ```
> 
> to build and object from the MapWritable values in the
> 
> > ```
> > > mapper. 
> > > 
> > > Consider values as MapWritable object. 
> > > When I try to get a specified value from values.get("title") per 
> > 
> > ```
> 
> example the returning value is null but the field
> 
> > ```
> > > exists in the values.keySet() 
> > > 
> > > Considering the following code : 
> > > 
> > > System.out.println(values.keySet()); 
> > > System.out.println(values.toString()); 
> > > System.out.println("title : " + values.get("title")); 
> > > System.out.println("category : " + values.get("category")); 
> > > 
> > > This is a snippet from the debug output : 
> > > 
> > > [title, categoryId] 
> > > {title=[Samsung EF-CI950BCEGWW S View], categoryId=[3485]} 
> > > title : null 
> > > category : null 
> > > 
> > > Thanks again! 
> > > 
> > > Le mardi 2 décembre 2014 12:36:57 UTC+1, Costin Leau a écrit : 
> > > 
> > > Simply specify the fields that you are interested in, in the 
> > 
> > ```
> 
> query and you are good to go.
> 
> > ```
> > > 
> > > [1]
> > 
> > ```
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html)
> 
> > ```
> > <
> > 
> > ```
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html)\>
> 
> > ```
> > > <
> > 
> > ```
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html)
> 
> > ```
> > <
> > 
> > ```
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html)\>\>
> 
> > ```
> > > 
> > > On 12/2/14 12:52 PM, Elias Abou Haydar wrote: 
> > > > I'm trying to write a mapreduce job where I can query 
> > 
> > ```
> 
> elasticsearch so it can return to me specific fields. Is there any
> 
> > ```
> > > > way to do that? 
> > > > 
> > > > My mapping contains about 30 fields and I will need just 4 
> > 
> > ```
> 
> of them ("\_id","title","description","category")
> 
> > ```
> > > > 
> > > > The way I was doing it is to process each answer to get 
> > 
> > ```
> 
> those fields, but I'm looking for a cleaner way to do that.
> 
> > ```
> > > > 
> > > > Any help or suggestion is appreciated. 
> > > > 
> > > > Thanks! 
> > > > 
> > > > -- 
> > > > You received this message because you are subscribed to the 
> > 
> > ```
> 
> Google Groups "elasticsearch" group.
> 
> > ```
> > > > To unsubscribe from this group and stop receiving emails 
> > 
> > ```
> 
> from it, send an email to
> 
> > ```
> > > >elasticsearc...@googlegroups.com <javascript:> <mailto:
> > 
> > ```
> 
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com) \<javascript:\> \<javascript:\>
> 
> > ```
> > <javascript:>>. 
> > > > To view this discussion on the web visit 
> > > >
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com)\>
> 
> > ```
> > > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com)\>\>
> 
> > ```
> > > > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer)\>
> 
> > ```
> > > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer)\>\>\>.
> 
> > ```
> > > 
> > > > For more options, visithttps://groups.google.com/d/optout <
> > 
> > ```
> 
> [http://groups.google.com/d/optout](http://groups.google.com/d/optout)\> \<[https://groups.google.com/d/optout](https://groups.google.com/d/optout)
> 
> > ```
> > <https://groups.google.com/d/optout>>. 
> > > 
> > > -- 
> > > Costin 
> > > 
> > > -- 
> > > You received this message because you are subscribed to the Google 
> > 
> > ```
> 
> Groups "elasticsearch" group.
> 
> > ```
> > > To unsubscribe from this group and stop receiving emails from it, 
> > 
> > ```
> 
> send an email to
> 
> > ```
> > >elasticsearc...@googlegroups.com <javascript:> <mailto:
> > 
> > ```
> 
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com) \<javascript:\> \<javascript:\>\>.
> 
> > ```
> > > To view this discussion on the web visit 
> > >
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com)\>
> 
> > ```
> > > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm_medium=email&utm_source=footer)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm_medium=email&utm_source=footer)\>\>.
> 
> > ```
> > > For more options, visithttps://groups.google.com/d/optout <
> > 
> > ```
> 
> [https://groups.google.com/d/optout](https://groups.google.com/d/optout)\>.
> 
> > ```
> > -- 
> > Costin 
> > 
> > ```
> > 
> > --  
> > You received this message because you are subscribed to the Google  
> > Groups "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send  
> > an email to  
> > [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\> \<mailto:  
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com) \<javascript:\>\>.  
> > To view this discussion on the web visit
> 
> [https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com)
> 
> > \<  
> > [https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com?utm_medium=email&utm_source=footer)\>.
> 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Costin

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/83dfbb85-53e3-47ca-a27b-e0410f4a0565%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/83dfbb85-53e3-47ca-a27b-e0410f4a0565%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![eliasah](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eliasah/32/34741_2.png) [@eliasah](https://discuss.elastic.co/u/eliasah)\
**Post date:** [December 3, 2014, 3:44pm UTC](https://discuss.elastic.co/t/elasticsearch-hadoop-getting-specified-fields-from-elasticsearch-as-an-input-to-a-mapreduce-job/21026/9 "2014-12-03T15:44:19Z")

</div>

Ok actually Strings() returns the String array that has the contents and  
that solved my problem.

Thanks again Costin! 🙂

Le mercredi 3 décembre 2014 16:29:38 UTC+1, Elias Abou Haydar a écrit :

> I've tried to call toStrings()  
> I got this :  
> title : [Ljava.lang.String;@35112ff7
> 
> with the get(), i'm getting this:  
> title : [Lorg.apache.hadoop.io.Writable;@666f5678
> 
> Le mercredi 3 décembre 2014 16:21:40 UTC+1, Costin Leau a écrit :
> 
> > You're getting back an array ([Samsung EF-C....]) - a Writable wrapper  
> > around org.hadoop.io.ArrayWritable (to actually  
> > allow it to be serialized).  
> > So call toStrings() or get() to get its content.
> > 
> > On 12/3/14 3:30 PM, Elias Abou Haydar wrote:
> > 
> > > I've tried that. It returns a  
> > > org.elasticsearch.hadoop.mr.WritableArrayWritable object. How can I get my  
> > > field content  
> > > out of that?
> > > 
> > > Le mercredi 3 décembre 2014 14:10:24 UTC+1, Costin Leau a écrit :
> > > 
> > > ```
> > > That's because your MapWritables doesn't use Strings as keys but 
> > > 
> > > ```
> > 
> > rather org.apache.hadoop.io.Text
> > 
> > > ```
> > > In other words, you can see the data is in the map however you 
> > > 
> > > ```
> > 
> > cannot retrieve it since you are using the wrong key
> > 
> > > ```
> > > (try 
> > > inspecting the map object types). 
> > > 
> > > Try values.get(new Text("title")) 
> > > 
> > > On 12/3/14 3:04 PM, Elias Abou Haydar wrote: 
> > > > That works fine for me thank you! But I'd also wanted to be able 
> > > 
> > > ```
> > 
> > to build and object from the MapWritable values in the
> > 
> > > ```
> > > > mapper. 
> > > > 
> > > > Consider values as MapWritable object. 
> > > > When I try to get a specified value from values.get("title") per 
> > > 
> > > ```
> > 
> > example the returning value is null but the field
> > 
> > > ```
> > > > exists in the values.keySet() 
> > > > 
> > > > Considering the following code : 
> > > > 
> > > > System.out.println(values.keySet()); 
> > > > System.out.println(values.toString()); 
> > > > System.out.println("title : " + values.get("title")); 
> > > > System.out.println("category : " + values.get("category")); 
> > > > 
> > > > This is a snippet from the debug output : 
> > > > 
> > > > [title, categoryId] 
> > > > {title=[Samsung EF-CI950BCEGWW S View], categoryId=[3485]} 
> > > > title : null 
> > > > category : null 
> > > > 
> > > > Thanks again! 
> > > > 
> > > > Le mardi 2 décembre 2014 12:36:57 UTC+1, Costin Leau a écrit : 
> > > > 
> > > > Simply specify the fields that you are interested in, in the 
> > > 
> > > ```
> > 
> > query and you are good to go.
> > 
> > > ```
> > > > 
> > > > [1]
> > > 
> > > ```
> > 
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html)
> > 
> > > ```
> > > <
> > > 
> > > ```
> > 
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html)\>
> > 
> > > ```
> > > > <
> > > 
> > > ```
> > 
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html)
> > 
> > > ```
> > > <
> > > 
> > > ```
> > 
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html)\>\>
> > 
> > > ```
> > > > 
> > > > On 12/2/14 12:52 PM, Elias Abou Haydar wrote: 
> > > > > I'm trying to write a mapreduce job where I can query 
> > > 
> > > ```
> > 
> > elasticsearch so it can return to me specific fields. Is there any
> > 
> > > ```
> > > > > way to do that? 
> > > > > 
> > > > > My mapping contains about 30 fields and I will need just 4 
> > > 
> > > ```
> > 
> > of them ("\_id","title","description","category")
> > 
> > > ```
> > > > > 
> > > > > The way I was doing it is to process each answer to get 
> > > 
> > > ```
> > 
> > those fields, but I'm looking for a cleaner way to do that.
> > 
> > > ```
> > > > > 
> > > > > Any help or suggestion is appreciated. 
> > > > > 
> > > > > Thanks! 
> > > > > 
> > > > > -- 
> > > > > You received this message because you are subscribed to the 
> > > 
> > > ```
> > 
> > Google Groups "elasticsearch" group.
> > 
> > > ```
> > > > > To unsubscribe from this group and stop receiving emails 
> > > 
> > > ```
> > 
> > from it, send an email to
> > 
> > > ```
> > > > >elasticsearc...@googlegroups.com <javascript:> <mailto:
> > > 
> > > ```
> > 
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com) \<javascript:\>
> > 
> > > ```
> > > <javascript:>>. 
> > > > > To view this discussion on the web visit 
> > > > >
> > > 
> > > ```
> > 
> > [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com)
> > 
> > > ```
> > > <
> > > 
> > > ```
> > 
> > [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com)\>
> > 
> > > ```
> > > > <
> > > 
> > > ```
> > 
> > [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com)
> > 
> > > ```
> > > <
> > > 
> > > ```
> > 
> > [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com)\>\>
> > 
> > > ```
> > > > > <
> > > 
> > > ```
> > 
> > [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer)
> > 
> > > ```
> > > <
> > > 
> > > ```
> > 
> > [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer)\>
> > 
> > > ```
> > > > <
> > > 
> > > ```
> > 
> > [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer)
> > 
> > > ```
> > > <
> > > 
> > > ```
> > 
> > [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer)\>\>\>.
> > 
> > > ```
> > > > 
> > > > > For more options, visithttps://groups.google.com/d/optout <
> > > 
> > > ```
> > 
> > [http://groups.google.com/d/optout](http://groups.google.com/d/optout)\> \<[https://groups.google.com/d/optout](https://groups.google.com/d/optout)
> > 
> > > ```
> > > <https://groups.google.com/d/optout>>. 
> > > > 
> > > > -- 
> > > > Costin 
> > > > 
> > > > -- 
> > > > You received this message because you are subscribed to the 
> > > 
> > > ```
> > 
> > Google Groups "elasticsearch" group.
> > 
> > > ```
> > > > To unsubscribe from this group and stop receiving emails from it, 
> > > 
> > > ```
> > 
> > send an email to
> > 
> > > ```
> > > >elasticsearc...@googlegroups.com <javascript:> <mailto:
> > > 
> > > ```
> > 
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com) \<javascript:\>\>.
> > 
> > > ```
> > > > To view this discussion on the web visit 
> > > >
> > > 
> > > ```
> > 
> > [https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com)
> > 
> > > ```
> > > <
> > > 
> > > ```
> > 
> > [https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com)\>
> > 
> > > ```
> > > > <
> > > 
> > > ```
> > 
> > [https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm_medium=email&utm_source=footer)
> > 
> > > ```
> > > <
> > > 
> > > ```
> > 
> > [https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm_medium=email&utm_source=footer)\>\>.
> > 
> > > ```
> > > > For more options, visithttps://groups.google.com/d/optout <
> > > 
> > > ```
> > 
> > [https://groups.google.com/d/optout](https://groups.google.com/d/optout)\>.
> > 
> > > ```
> > > -- 
> > > Costin 
> > > 
> > > ```
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to  
> > > [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<mailto:  
> > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com)\>.  
> > > To view this discussion on the web visit
> > 
> > [https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com)
> > 
> > > \<  
> > > [https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com?utm_medium=email&utm_source=footer)\>.
> > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > Costin

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/86ed3c43-2189-4be8-8e19-c3ea986602fd%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/86ed3c43-2189-4be8-8e19-c3ea986602fd%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![costin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/costin/32/44950_2.png) [@costin](https://discuss.elastic.co/u/costin)\
**Post date:** [December 3, 2014, 3:50pm UTC](https://discuss.elastic.co/t/elasticsearch-hadoop-getting-specified-fields-from-elasticsearch-as-an-input-to-a-mapreduce-job/21026/10 "2014-12-03T15:50:20Z")

</div>

I'm not sure what you are expecting since the results are as expected. See the javadocs [1] for ArrayWritable.  
toStrings() returns a String while get() a Writable. In other words you get an array of Strings and Writables and  
neither  
implements toString natively.  
To get the actual content you have to iterate through the array - to simply print out the array content try  
java.util.Arrays.toString().

The above is just MapReduce/Java code - fairly straight-forward. I strongly recommend going through the javadocs and  
playing around with the APIs;  
if that is not appealing to you than potentially using a higher level abstraction (like Cascading) would make sense over  
Map/Reduce...

[1] [ArrayWritable (Apache Hadoop Main 3.3.6 API)](https://hadoop.apache.org/docs/current/api/org/apache/hadoop/io/ArrayWritable.html)

On 12/3/14 5:29 PM, Elias Abou Haydar wrote:

> I've tried to call toStrings()  
> I got this :  
> title : [Ljava.lang.String;@35112ff7
> 
> with the get(), i'm getting this:  
> title : [Lorg.apache.hadoop.io.Writable;@666f5678
> 
> Le mercredi 3 décembre 2014 16:21:40 UTC+1, Costin Leau a écrit :
> 
> ```
> You're getting back an array ([Samsung EF-C....]) - a Writable wrapper around org.hadoop.io.ArrayWritable (to actually
> allow it to be serialized).
> So call toStrings() or get() to get its content.
> 
> On 12/3/14 3:30 PM, Elias Abou Haydar wrote:
> > I've tried that. It returns a org.elasticsearch.hadoop.mr.WritableArrayWritable object. How can I get my field content
> > out of that?
> >
> > Le mercredi 3 décembre 2014 14:10:24 UTC+1, Costin Leau a écrit :
> >
> > That's because your MapWritables doesn't use Strings as keys but rather org.apache.hadoop.io.Text
> > In other words, you can see the data is in the map however you cannot retrieve it since you are using the wrong key
> > (try
> > inspecting the map object types).
> >
> > Try values.get(new Text("title"))
> >
> >
> > On 12/3/14 3:04 PM, Elias Abou Haydar wrote:
> > > That works fine for me thank you! But I'd also wanted to be able to build and object from the MapWritable values in the
> > > mapper.
> > >
> > > Consider values as MapWritable object.
> > > When I try to get a specified value from values.get("title") per example the returning value is null but the field
> > > exists in the values.keySet()
> > >
> > > Considering the following code :
> > >
> > > System.out.println(values.keySet());
> > > System.out.println(values.toString());
> > > System.out.println("title : " + values.get("title"));
> > > System.out.println("category : " + values.get("category"));
> > >
> > > This is a snippet from the debug output :
> > >
> > > [title, categoryId]
> > > {title=[Samsung EF-CI950BCEGWW S View], categoryId=[3485]}
> > > title : null
> > > category : null
> > >
> > > Thanks again!
> > >
> > > Le mardi 2 décembre 2014 12:36:57 UTC+1, Costin Leau a écrit :
> > >
> > > Simply specify the fields that you are interested in, in the query and you are good to go.
> > >
> > > [1]http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html
> <http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html>
> > <http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html
> <http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html>>
> > > <http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html
> <http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html>
> > <http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html
> <http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html>>>
> > >
> > > On 12/2/14 12:52 PM, Elias Abou Haydar wrote:
> > > > I'm trying to write a mapreduce job where I can query elasticsearch so it can return to me specific fields. Is there any
> > > > way to do that?
> > > >
> > > > My mapping contains about 30 fields and I will need just 4 of them ("_id","title","description","category")
> > > >
> > > > The way I was doing it is to process each answer to get those fields, but I'm looking for a cleaner way to do that.
> > > >
> > > > Any help or suggestion is appreciated.
> > > >
> > > > Thanks!
> > > >
> > > > --
> > > > You received this message because you are subscribed to the Google Groups "elasticsearch" group.
> > > > To unsubscribe from this group and stop receiving emails from it, send an email to
> > > >elasticsearc...@googlegroups.com <javascript:> <mailto:elasticsearch+unsubscribe@googlegroups.com <javascript:>
> <javascript:>
> > <javascript:>>.
> > > > To view this discussion on the web visit
> > > >https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com>
> > <https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com>>
> > > <https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com>
> > <https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com>>>
> > > > <https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer>
> 
> > <https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer>>
> 
> >
> > > <https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer>
> 
> > <https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer>>>>.
> 
> >
> > >
> > > > For more options, visithttps://groups.google.com/d/optout <http://groups.google.com/d/optout> <http://groups.google.com/d/optout
> <http://groups.google.com/d/optout>> <https://groups.google.com/d/optout <https://groups.google.com/d/optout>
> > <https://groups.google.com/d/optout <https://groups.google.com/d/optout>>>.
> > >
> > > --
> > > Costin
> > >
> > > --
> > > You received this message because you are subscribed to the Google Groups "elasticsearch" group.
> > > To unsubscribe from this group and stop receiving emails from it, send an email to
> > >elasticsearc...@googlegroups.com <javascript:> <mailto:elasticsearch+unsubscribe@googlegroups.com <javascript:>
> <javascript:>>.
> > > To view this discussion on the web visit
> > >https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com>
> > <https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com>>
> > > <https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm_medium=email&utm_source=footer>
> 
> > <https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm_medium=email&utm_source=footer>>>.
> 
> >
> > > For more options, visithttps://groups.google.com/d/optout <http://groups.google.com/d/optout> <https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>>.
> > --
> > Costin
> >
> > --
> > You received this message because you are subscribed to the Google Groups "elasticsearch" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to
> >elasticsearc...@googlegroups.com <javascript:> <mailto:elasticsearch+unsubscribe@googlegroups.com <javascript:>>.
> > To view this discussion on the web visit
> >https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com>
> > <https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com?utm_medium=email&utm_source=footer>>.
> 
> > For more options, visithttps://groups.google.com/d/optout <https://groups.google.com/d/optout>.
> 
> --
> Costin
> 
> ```
> 
> --  
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com) [mailto:elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/83dfbb85-53e3-47ca-a27b-e0410f4a0565%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/83dfbb85-53e3-47ca-a27b-e0410f4a0565%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/83dfbb85-53e3-47ca-a27b-e0410f4a0565%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/83dfbb85-53e3-47ca-a27b-e0410f4a0565%40googlegroups.com?utm_medium=email&utm_source=footer).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Costin

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/547F313C.5090601%40gmail.com](https://groups.google.com/d/msgid/elasticsearch/547F313C.5090601%40gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![eliasah](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eliasah/32/34741_2.png) [@eliasah](https://discuss.elastic.co/u/eliasah)\
**Post date:** [December 3, 2014, 3:57pm UTC](https://discuss.elastic.co/t/elasticsearch-hadoop-getting-specified-fields-from-elasticsearch-as-an-input-to-a-mapreduce-job/21026/11 "2014-12-03T15:57:25Z")

</div>

I have actually went through the API and I get the big picture now.

I appreciate your help. Thanks! 🙂

Le mercredi 3 décembre 2014 16:50:33 UTC+1, Costin Leau a écrit :

> I'm not sure what you are expecting since the results are as expected. See  
> the javadocs [1] for ArrayWritable.  
> toStrings() returns a String while get() a Writable. In other words  
> you get an array of Strings and Writables and  
> neither  
> implements toString natively.  
> To get the actual content you have to iterate through the array - to  
> simply print out the array content try  
> java.util.Arrays.toString().
> 
> The above is just MapReduce/Java code - fairly straight-forward. I  
> strongly recommend going through the javadocs and  
> playing around with the APIs;  
> if that is not appealing to you than potentially using a higher level  
> abstraction (like Cascading) would make sense over  
> Map/Reduce...
> 
> [1]  
> [ArrayWritable (Apache Hadoop Main 3.3.6 API)](https://hadoop.apache.org/docs/current/api/org/apache/hadoop/io/ArrayWritable.html)
> 
> On 12/3/14 5:29 PM, Elias Abou Haydar wrote:
> 
> > I've tried to call toStrings()  
> > I got this :  
> > title : [Ljava.lang.String;@35112ff7
> > 
> > with the get(), i'm getting this:  
> > title : [Lorg.apache.hadoop.io.Writable;@666f5678
> > 
> > Le mercredi 3 décembre 2014 16:21:40 UTC+1, Costin Leau a écrit :
> > 
> > ```
> > You're getting back an array ([Samsung EF-C....]) - a Writable 
> > 
> > ```
> 
> wrapper around org.hadoop.io.ArrayWritable (to actually
> 
> > ```
> > allow it to be serialized). 
> > So call toStrings() or get() to get its content. 
> > 
> > On 12/3/14 3:30 PM, Elias Abou Haydar wrote: 
> > > I've tried that. It returns a 
> > 
> > ```
> 
> org.elasticsearch.hadoop.mr.WritableArrayWritable object. How can I get my  
> field content
> 
> > ```
> > > out of that? 
> > > 
> > > Le mercredi 3 décembre 2014 14:10:24 UTC+1, Costin Leau a écrit : 
> > > 
> > > That's because your MapWritables doesn't use Strings as keys 
> > 
> > ```
> 
> but rather org.apache.hadoop.io.Text
> 
> > ```
> > > In other words, you can see the data is in the map however you 
> > 
> > ```
> 
> cannot retrieve it since you are using the wrong key
> 
> > ```
> > > (try 
> > > inspecting the map object types). 
> > > 
> > > Try values.get(new Text("title")) 
> > > 
> > > 
> > > On 12/3/14 3:04 PM, Elias Abou Haydar wrote: 
> > > > That works fine for me thank you! But I'd also wanted to be 
> > 
> > ```
> 
> able to build and object from the MapWritable values in the
> 
> > ```
> > > > mapper. 
> > > > 
> > > > Consider values as MapWritable object. 
> > > > When I try to get a specified value from values.get("title") 
> > 
> > ```
> 
> per example the returning value is null but the field
> 
> > ```
> > > > exists in the values.keySet() 
> > > > 
> > > > Considering the following code : 
> > > > 
> > > > System.out.println(values.keySet()); 
> > > > System.out.println(values.toString()); 
> > > > System.out.println("title : " + values.get("title")); 
> > > > System.out.println("category : " + values.get("category")); 
> > > > 
> > > > This is a snippet from the debug output : 
> > > > 
> > > > [title, categoryId] 
> > > > {title=[Samsung EF-CI950BCEGWW S View], categoryId=[3485]} 
> > > > title : null 
> > > > category : null 
> > > > 
> > > > Thanks again! 
> > > > 
> > > > Le mardi 2 décembre 2014 12:36:57 UTC+1, Costin Leau a écrit 
> > 
> > ```
> 
> :
> 
> > ```
> > > > 
> > > > Simply specify the fields that you are interested in, in 
> > 
> > ```
> 
> the query and you are good to go.
> 
> > ```
> > > > 
> > > > [1]
> > 
> > ```
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html)
> 
> > ```
> > <
> > 
> > ```
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html)\>
> 
> > ```
> > > <
> > 
> > ```
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html)
> 
> > ```
> > <
> > 
> > ```
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html)\>\>
> 
> > ```
> > > > <
> > 
> > ```
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html)
> 
> > ```
> > <
> > 
> > ```
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html)\>
> 
> > ```
> > > <
> > 
> > ```
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html)
> 
> > ```
> > <
> > 
> > ```
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html)\>\>\>
> 
> > ```
> > > > 
> > > > On 12/2/14 12:52 PM, Elias Abou Haydar wrote: 
> > > > > I'm trying to write a mapreduce job where I can query 
> > 
> > ```
> 
> elasticsearch so it can return to me specific fields. Is there any
> 
> > ```
> > > > > way to do that? 
> > > > > 
> > > > > My mapping contains about 30 fields and I will need 
> > 
> > ```
> 
> just 4 of them ("\_id","title","description","category")
> 
> > ```
> > > > > 
> > > > > The way I was doing it is to process each answer to 
> > 
> > ```
> 
> get those fields, but I'm looking for a cleaner way to do that.
> 
> > ```
> > > > > 
> > > > > Any help or suggestion is appreciated. 
> > > > > 
> > > > > Thanks! 
> > > > > 
> > > > > -- 
> > > > > You received this message because you are subscribed 
> > 
> > ```
> 
> to the Google Groups "elasticsearch" group.
> 
> > ```
> > > > > To unsubscribe from this group and stop receiving 
> > 
> > ```
> 
> emails from it, send an email to
> 
> > ```
> > > > >elasticsearc...@googlegroups.com <javascript:> <mailto:
> > 
> > ```
> 
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com) \<javascript:\> \<javascript:\>
> 
> > ```
> > <javascript:> 
> > > <javascript:>>. 
> > > > > To view this discussion on the web visit 
> > > > >
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com)\>
> 
> > ```
> > > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com)\>\>
> 
> > ```
> > > > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com)\>
> 
> > ```
> > > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com)\>\>\>
> 
> > ```
> > > > > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer)\>
> 
> > ```
> > > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer)\>\>
> 
> > ```
> > > 
> > > > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer)\>
> 
> > ```
> > > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ac512248-b3fe-4023-b28e-a4263ae720ec%40googlegroups.com?utm_medium=email&utm_source=footer)\>\>\>\>.
> 
> > ```
> > > 
> > > > 
> > > > > For more options, visithttps://
> > 
> > ```
> 
> [groups.google.com/d/optout](http://groups.google.com/d/optout) [http://groups.google.com/d/optout](http://groups.google.com/d/optout) \<  
> [http://groups.google.com/d/optout](http://groups.google.com/d/optout)
> 
> > ```
> > <http://groups.google.com/d/optout>> <
> > 
> > ```
> 
> [https://groups.google.com/d/optout](https://groups.google.com/d/optout) [https://groups.google.com/d/optout](https://groups.google.com/d/optout)
> 
> > ```
> > > <https://groups.google.com/d/optout <
> > 
> > ```
> 
> [https://groups.google.com/d/optout](https://groups.google.com/d/optout)\>\>\>.
> 
> > ```
> > > > 
> > > > -- 
> > > > Costin 
> > > > 
> > > > -- 
> > > > You received this message because you are subscribed to the 
> > 
> > ```
> 
> Google Groups "elasticsearch" group.
> 
> > ```
> > > > To unsubscribe from this group and stop receiving emails 
> > 
> > ```
> 
> from it, send an email to
> 
> > ```
> > > >elasticsearc...@googlegroups.com <javascript:> <mailto:
> > 
> > ```
> 
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com) \<javascript:\> \<javascript:\>
> 
> > ```
> > <javascript:>>. 
> > > > To view this discussion on the web visit 
> > > >
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com)\>
> 
> > ```
> > > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com)\>\>
> 
> > ```
> > > > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm_medium=email&utm_source=footer)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm_medium=email&utm_source=footer)\>
> 
> > ```
> > > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm_medium=email&utm_source=footer)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0b096d2b-4dab-443a-b9ca-cd249a0523d8%40googlegroups.com?utm_medium=email&utm_source=footer)\>\>\>.
> 
> > ```
> > > 
> > > > For more options, visithttps://groups.google.com/d/optout <
> > 
> > ```
> 
> [http://groups.google.com/d/optout](http://groups.google.com/d/optout)\> \<[https://groups.google.com/d/optout](https://groups.google.com/d/optout)
> 
> > ```
> > <https://groups.google.com/d/optout>>. 
> > > -- 
> > > Costin 
> > > 
> > > -- 
> > > You received this message because you are subscribed to the Google 
> > 
> > ```
> 
> Groups "elasticsearch" group.
> 
> > ```
> > > To unsubscribe from this group and stop receiving emails from it, 
> > 
> > ```
> 
> send an email to
> 
> > ```
> > >elasticsearc...@googlegroups.com <javascript:> <mailto:
> > 
> > ```
> 
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com) \<javascript:\> \<javascript:\>\>.
> 
> > ```
> > > To view this discussion on the web visit 
> > >
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com)\>
> 
> > ```
> > > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com?utm_medium=email&utm_source=footer)
> 
> > ```
> > <
> > 
> > ```
> 
> [https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0362a051-0e5c-4861-96fd-290d131ce726%40googlegroups.com?utm_medium=email&utm_source=footer)\>\>.
> 
> > ```
> > > For more options, visithttps://groups.google.com/d/optout <
> > 
> > ```
> 
> [https://groups.google.com/d/optout](https://groups.google.com/d/optout)\>.
> 
> > ```
> > -- 
> > Costin 
> > 
> > ```
> > 
> > --  
> > You received this message because you are subscribed to the Google  
> > Groups "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send  
> > an email to  
> > [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\> \<mailto:  
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com) \<javascript:\>\>.  
> > To view this discussion on the web visit
> 
> [https://groups.google.com/d/msgid/elasticsearch/83dfbb85-53e3-47ca-a27b-e0410f4a0565%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/83dfbb85-53e3-47ca-a27b-e0410f4a0565%40googlegroups.com)
> 
> > \<  
> > [https://groups.google.com/d/msgid/elasticsearch/83dfbb85-53e3-47ca-a27b-e0410f4a0565%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/83dfbb85-53e3-47ca-a27b-e0410f4a0565%40googlegroups.com?utm_medium=email&utm_source=footer)\>.
> 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Costin

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/892758db-bcfe-4871-bb2c-47fbf33e0bb6%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/892758db-bcfe-4871-bb2c-47fbf33e0bb6%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:46am UTC](https://discuss.elastic.co/t/elasticsearch-hadoop-getting-specified-fields-from-elasticsearch-as-an-input-to-a-mapreduce-job/21026/12 "2017-07-06T00:46:10Z")

</div>


