Highlighting matched results on _all fields

I want the matched results to be highlighted. This works for me if I
mention the field name and it returns the highlighted text, however if
I give the field as "_all", it is not returning any value. This works
for me:
curl -XGET "http://localhost:9200/my_index/my_type/_search?
q=stackoverflow&size=999" -d '{
"highlight":{
"fields":{
"my_field":{}
}
}
}'

This returns the expected value as follows: [highlight] => stdClass
Object ( [my_field] => Array ( [0] => stackoverflow is the best
website for techies ) )

But when I give this:

    curl -XGET "http://localhost:9200/my_index/my_type/_search?

q=stackoverflow&size=999" -d '{
"highlight":{
"fields":{
"_all":{}
}
}
}'

I get null value/no result.

[highlight] => stdClass Object ( [_all] => Array () )
How do I get it to work on any field so that I don't have to mention
the field name?

The _all field is a special field, which includes all the other fields. If
you want to be able to highlight it, you need to store it specifically
(which will add to the index size). Specific fields can be extracted from
the "_source" document stored.

On Sun, Nov 27, 2011 at 5:21 PM, Niranjan niranjan.u@gmail.com wrote:

I want the matched results to be highlighted. This works for me if I
mention the field name and it returns the highlighted text, however if
I give the field as "_all", it is not returning any value. This works
for me:
curl -XGET "http://localhost:9200/my_index/my_type/_search?
q=stackoverflow&size=999" -d '{
"highlight":{
"fields":{
"my_field":{}
}
}
}'

This returns the expected value as follows: [highlight] => stdClass
Object ( [my_field] => Array ( [0] => stackoverflow is the best
website for techies ) )

But when I give this:

   curl -XGET "http://localhost:9200/my_index/my_type/_search?

q=stackoverflow&size=999" -d '{
"highlight":{
"fields":{
"_all":{}
}
}
}'

I get null value/no result.

[highlight] => stdClass Object ( [_all] => Array () )
How do I get it to work on any field so that I don't have to mention
the field name?