Skip to content

Latest commit

 

History

History
76 lines (64 loc) · 1.06 KB

File metadata and controls

76 lines (64 loc) · 1.06 KB

Source filtering

Excluding the _source field altogether

GET /recipes/_search
{
  "_source": false,
  "query": {
    "match": { "title": "pasta" }
  }
}

Only returning the created field

GET /recipes/_search
{
  "_source": "created",
  "query": {
    "match": { "title": "pasta" }
  }
}

Only returning an object's key

GET /recipes/_search
{
  "_source": "ingredients.name",
  "query": {
    "match": { "title": "pasta" }
  }
}

Returning all of an object's keys

GET /recipes/_search
{
  "_source": "ingredients.*",
  "query": {
    "match": { "title": "pasta" }
  }
}

Returning the ingredients object with all keys, and the servings field

GET /recipes/_search
{
  "_source": [ "ingredients.*", "servings" ],
  "query": {
    "match": { "title": "pasta" }
  }
}

Including all of the ingredients object's keys, except the name key

GET /recipes/_search
{
  "_source": {
    "includes": "ingredients.*",
    "excludes": "ingredients.name"
  },
  "query": {
    "match": { "title": "pasta" }
  }
}