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]
>> 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+unsubscr...@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+unsubscr...@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 
>> > elasticsearc...@googlegroups.com <mailto:
>> elasticsearch+unsubscr...@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?utm_medium=email&utm_source=footer>.
>>  
>>
>> > For more options, visit 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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/86ed3c43-2189-4be8-8e19-c3ea986602fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to