Displaying Specific Fields in Search Results ES7

In ES 6.7, I could execute the following:
GET /my_index/_search
{
"_source": "name",
"query": {
"query_string": {
"query": "Columbia"
}
}
}

And my search results would only show me the Name field.

When I do this same search in ES7.0, I don't see the Name field in my search results. How do I modify my search appropriately?

Thanks!

Hey,

can you share a fully reproducible example? This works for me

PUT my_index/_doc/1
{
  "name" : "my_name",
  "location" : "Columbia"
}

# output contains my_name, but not Columbia
GET /my_index/_search
{
  "_source": "name",
  "query": {
    "query_string": {
      "query": "Columbia"
    }
  }
}

Thanks!

You're right, there are no problems. I misspelled the field name. Thanks!

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.