concept nested in category elasticsearch

This is an excerpt from Manning's book Elasticsearch in Action.
There are some additional types not covered in this chapter. For example, there’s the nested type, which allows you to have documents within documents, or the geo_point type, which stores a location on Earth based on its longitude and latitude. We’ll discuss those additional types in chapter 8, where we cover relationships among documents, and in appendix A, where we discuss geospatial data.
If you need to make sure such cross-object matches don’t happen, you can use the nested type, which will index your events in separate Lucene documents. In both cases, the group’s JSON document will look exactly the same, and applications will index each in the same way. The difference is in the mapping, which triggers Elasticsearch to index nested inner objects in adjacent but separate Lucene documents, as illustrated in figure 8.2. When searching, you’ll need to use nested filters and queries, which will be explored in section 8.2; those will search in all those Lucene documents.
As with mappings, when you run searches and aggregations on nested documents you’ll need to specify that the objects you’re looking at are nested. There are nested queries, filters, and aggregations that help you achieve this. Running these special queries and aggregations will trigger Elasticsearch to join the different Lucene documents within the same block and treat the resulting data as the same Elasticsearch document.
The way to search within nested documents is to use the nested query or nested filter. As you might expect after chapter 4, these are equivalent, with the traditional differences between queries and filters:
When you run a nested query or filter, you need to specify the path argument to tell Elasticsearch where in the Lucene block those nested objects are located. In addition to that, your nested query or filter will wrap a regular query or filter, respectively. In the next listing, you’ll search for members with the first name “Lee” and the last name “Gheorghe,” and you’ll see that the document indexed in listing 8.3 won’t match because you have only Lee Hinman and Radu Gheorghe and no member called Lee Gheorghe.
A nested filter would look exactly the same as the nested query you just saw. You’ll have to replace the word query with filter.