Skip to content

Instantly share code, notes, and snippets.

@grantm
Created November 13, 2016 20:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grantm/2f4b262677c329438f3b9c42dba827b2 to your computer and use it in GitHub Desktop.
Save grantm/2f4b262677c329438f3b9c42dba827b2 to your computer and use it in GitHub Desktop.
Metacpan API /v1 fields

/v0 search: latest releases for author

{
   "_shards" : {
      "total" : 5,
      "failed" : 0,
      "successful" : 5
   },
   "hits" : {
      "hits" : [
         {
            "_id" : "2vHMhTwJ3k4XOMELoXKq69F4s6Y",
            "fields" : {
               "status" : "latest",
               "name" : "Test-ShellScript-0.04"
            },
            "_type" : "release",
            "_score" : 13.3928385,
            "_index" : "cpan_v1"
         },
         {
            "fields" : {
               "name" : "Twitter-Daily-0.1.3",
               "status" : "latest"
            },
            "_id" : "_TPbB0o1ZEuIsLT_qDsWEu8igqU",
            "_index" : "cpan_v1",
            "_score" : 13.273382,
            "_type" : "release"
         }
      ],
      "total" : 2,
      "max_score" : 13.3928385
   },
   "timed_out" : false,
   "took" : 5
}

/v1 search: latest releases for author

{
   "took" : 58,
   "timed_out" : false,
   "hits" : {
      "max_score" : 13.8107395,
      "hits" : [
         {
            "_index" : "cpan_v1",
            "_type" : "release",
            "_id" : "2vHMhTwJ3k4XOMELoXKq69F4s6Y",
            "_score" : 13.8107395,
            "fields" : {
               "name" : [
                  "Test-ShellScript-0.04"
               ],
               "status" : [
                  "latest"
               ]
            }
         },
         {
            "_score" : 13.286617,
            "fields" : {
               "status" : [
                  "latest"
               ],
               "name" : [
                  "Twitter-Daily-0.1.3"
               ]
            },
            "_id" : "_TPbB0o1ZEuIsLT_qDsWEu8igqU",
            "_index" : "cpan_v1",
            "_type" : "release"
         }
      ],
      "total" : 2
   },
   "_shards" : {
      "total" : 3,
      "failed" : 0,
      "successful" : 3
   }
}

Note field values:

"fields" : {
   "status" : "latest",
   "name" : "Test-ShellScript-0.04"
},

vs

"fields" : {
   "name" : [
      "Test-ShellScript-0.04"
   ],
   "status" : [
      "latest"
   ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment