Skip to content

Instantly share code, notes, and snippets.

@chadkouse
chadkouse / elasticsearch parent child
Created June 5, 2013 15:41
Requests to elasticsearch to index a share + comments
PUT to http://host:9200/shares/share/1370441011073780507
content:
{
"artist": "Black Sabbath",
"id": "1370441011073780507",
"lyrics": "",
"song_title": "Am I Going Insane",
"media_url": "http://s3.amazonaws.com/images.tunewiki.com/shares/mobile/large/75475a5f15a0d9be76bf6822139119c0.jpg",
"has_lyric_art": true,
"has_comment": true,
File.open('foo_sorted_reduced.tab', 'w:UTF-8') { |f|
File.open('foo_sorted.tab', 'r:UTF-8').each_line do |line|
parts = line.strip.split("\t")
song_id = parts[0]
artist = parts[1]
title = parts[2]
date = parts[3]
country = parts[4]
if last_song_id == -1
last_song_id = song_id
<?php
/**
* @uri /lyrics/:artist/:title
*/
class Lyrics extends Tonic\Resource {
/**
* @method GET
* @provides application/json