"fields" parameter with dot notation

Hi,

      Elasticsearch's search API supports a "fields" parameter to limit 

the fields returned from the hits. It supports dot notation for
sub-properties of a document as well. For example, a query

{
"fields" : ["user.lastname"],
"query" : {
"term" : { "_id" : 1 }
}
}

will return hits as:

{
"hits": [
{"_id": 1,
"user.lastname": "Smith"}
]
}

I am wondering if there is an option to make it return as this instead:
{
"hits": [
{"_id": 1,
"user": {"lastname": "Smith"}}
]
}

The benefit of the second one is maintaining the same structure as the full
document, as that the following data access logic is consistent.

Is it a reasonable feature request?

Chunlei

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Any comment on why the current behavior is chosen not the other? Thanks.

On Friday, May 31, 2013 2:27:12 PM UTC-7, Chunlei Wu wrote:

Hi,

      Elasticsearch's search API supports a "fields" parameter to 

limit the fields returned from the hits. It supports dot notation for
sub-properties of a document as well. For example, a query

{
"fields" : ["user.lastname"],
"query" : {
"term" : { "_id" : 1 }
}
}

will return hits as:

{
"hits": [
{"_id": 1,
"user.lastname": "Smith"}
]
}

I am wondering if there is an option to make it return as this instead:
{
"hits": [
{"_id": 1,
"user": {"lastname": "Smith"}}
]
}

The benefit of the second one is maintaining the same structure as the
full document, as that the following data access logic is consistent.

Is it a reasonable feature request?

Chunlei

--
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.
For more options, visit https://groups.google.com/groups/opt_out.