Basic elasticsearch querying

Hey guys,

I need some help with a very basic elasticsearch query.

We have an index known as 'episodes' that has a list of tv shows in it.

root@aoaapld00135la ~]# curl http://localhost:9200/_cat/indices  | grep episodes
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1500  100  1500    0     0  23036      0 --:--:-- --:--:-- --:--:-- 25862
green open episodes           5 1      3 0  35.7kb  17.9kb

I can view the contents of the index using the 'search' parameter'

[root@aoaapld00135la ~]# curl http://localhost:9200/episodes/_search
{"took":3,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":3,"max_score":1.0,"hits":[{"_index":"episodes","_type":"episode","_id":"4","_score":1.0,"_source":{"id":4,"number":"0010","show_id":3,"title":"NBC Cancels Star Trek","air_date":"1977-07-04","season":"4","episode_type":"live","hosts":[{"id":7,"name":"Elliot Gould","distinguishing_info":null}],"musical_guests":[{"id":10,"name":"Sex Pistols","distinguishing_info":null}],"episode_versions":[{"id":4,"video_url":"http://www.pivotal.io","episode_id":4,"air_date":"1977-07-04","episode_version_type_id":3,"repeat_text":"some data for SNL entered by pivotal","parent_episode_version_id":null,"episode_version_type":{"id":3,"show_id":3,"name":"Air"},"segments":[]}]}},{"_index":"episodes","_type":"episode","_id":"7","_score":1.0,"_source":{"id":7,"number":"0020","show_id":3,"title":"CF is delivered","air_date":null,"season":"","episode_type":"","hosts":[{"id":13,"name":"Chris Umbel","distinguishing_info":null},{"id":16,"name":"Shaozhen Ding","distinguishing_info":null}],"musical_guests":[{"id":19,"name":"GT","distinguishing_info":null}],"episode_versions":[{"id":7,"video_url":"http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_640x360.m4v","episode_id":7,"air_date":"2015-06-05","episode_version_type_id":3,"repeat_text":"pivotal, GT, umbel, ding, JMX","parent_episode_version_id":null,"episode_version_type":{"id":3,"show_id":3,"name":"Air"},"segments":[{"id":4,"name":"New Segment","synopsis":"PBR\u0026B meditation scenester, freegan artisan Tumblr forage Kickstarter cliche paleo Portland post-ironic McSweeney's synth whatever. Lo-fi Truffaut crucifix vegan meditation, lomo ethical leggings.","tags":"","episode_version_id":7,"video_start_time":"00:02:22","video_end_time":"00:04:00","segment_type":"","production_number":"","tape_date":"2015-06-19","order":1,"live":false,"show_id":3,"duration":"","guests":[{"id":22,"name":"Tom Cruise","distinguishing_info":null}],"writers":[],"producers":[],"cast_credits":[]}]},{"id":10,"video_url":"http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_640x360.m4v","episode_id":7,"air_date":null,"episode_version_type_id":3,"repeat_text":"","parent_episode_version_id":7,"episode_version_type":{"id":3,"show_id":3,"name":"Air"},"segments":[]}]}},{"_index":"episodes","_type":"episode","_id":"3","_score":1.0,"_source":{"id":3,"number":"001","show_id":3,"title":"Episode One","air_date":"2015-06-01","season":"1","episode_type":"Live Taping","hosts":[{"id":3,"name":"Snoop Dogg","distinguishing_info":null}],"musical_guests":[{"id":6,"name":"John Legend","distinguishing_info":null}],"episode_versions":[{"id":3,"video_url":"","episode_id":3,"air_date":"2015-06-25","episode_version_type_id":3,"repeat_text":"","parent_episode_version_id":null,"episode_version_type":{"id":3,"show_id":3,"name":"Air"},"segments":[]}]}}]}}

So if I wanted to find the episode with the id of 19

{"id":19,"name":"GT","distinguishing_info":null}

How can I format this query? I tried going:

But all I got back was this instead of the info from the 'episode':

[root@aoaapld00135la ~]# curl http://localhost:9200/episodes/type/_search?q=id:16
{"took":2,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}

Can you please let me know how to format this query?

Thanks

Never mind, I think I got it:

#curl http://3.3.87.69:9200/episodes/_search?pretty  -d '
{
  "query": { "match_all": {} },
  "_source": ["title","NBC Cancels Star Trek"]
}'

Gives me:

{
  "took" : 3,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : 3,
    "max_score" : 1.0,
    "hits" : [ {
      "_index" : "episodes",
      "_type" : "episode",
      "_id" : "4",
      "_score" : 1.0,
      "_source":{"title":"NBC Cancels Star Trek"}
    }, {
      "_index" : "episodes",
      "_type" : "episode",
      "_id" : "7",
      "_score" : 1.0,
      "_source":{"title":"CF is delivered"}
    }, {
      "_index" : "episodes",
      "_type" : "episode",
      "_id" : "3",
      "_score" : 1.0,
      "_source":{"title":"Episode One"}
    } ]
  }
}

Thanks