karmi/tire — pull request #434 by simonjsmithuk (2012-08-17 21:41:46+00:00)
Title: Added support for partial_fields

I added a simple method to support partial_fields. partial_fields allow the returning of a subset of the record in elastic search. For example if your structured data looks like this:

```
:data => {
:name => {
:first => "James",
:last => "Bond"
}
}

```

This could be queried to get the partial records as such:

```
s = Tire.search('articles') do
query do
string "James"
end
partial_fields "header", ['data.name.last.*']
end

```

The record returned will contain a field called 'header' with the hash

```
:data => {
:name => {
:last => "Bond"
}
}
```

The function also supports exclude, but this seem to have no effect on the returned data. It is passed in the query as documented in the elastic search documentation.There may be multiple fields in each the include list and exclude list.

http://www.elasticsearch.org/guide/reference/api/search/fields.html