If you already have your data indexed as shown (that means: each document has a Name, Year and Gear field) then a correct query will return you a list of documents of this type.
An example of such query is the below (more options are available - more info on query dsl check here - http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl.html).
"query": {
"bool": {
"must": [
{"match": { "Name": "C30" }},
{"match": { "Gear": "A" }}
]
}
}
If you want a result as the one you describe you should apply some post processing on your data after they are received from the search result.
However, if your data are not already indexed, or you don't care changing your policy then I would propose to denormalize your data and index them in a form that best suits you.
I propose to index a document like the one below:
public class ObjectToIndex{
public string Name;
public string Gear;
public List<string> Years;
}
Your data will now look like
Name | Gear | Years
C30 A 2012,2015,2013
C30 M 2011,2014
V40 A 2012,2015
V40 M 2013
S60 A 2011
S60 M 2012
In this case,a query like the above would return you a document like:
C30, A, 2012,2015,2013