Hi all!
I'm using nested mapping for my index. When I'm quering data with nested
query elasticsearch returns whole _source document.

For example, nested query

{
  "query": {
    "nested": {
      "path": "books",
      "query": {
        "term": {
          "books.category_id": 2
        }
      }
    }
  }
}

returns matched document with source:

_source: {
  id: 1,
  author: me,
  books: [
    {
      title: title1,
      category_id: 1
    },
    {
      title: title2,
      category_id: 2
    }
  ]
}

I'm interesting, can results return only with matched category_id, like

_source: {
  id: 1,
  author: me,
  books: [
    {
      title: title2,
      category_id: 2
    }
  ]
}

For example, in Apache Solr it can be done with ChildTransormer.
Thanks for any help.




--
View this message in context: 
http://elasticsearch-users.115913.n3.nabble.com/NestedQuery-Filter-source-tp4071638.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/1425572638163-4071638.post%40n3.nabble.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to