Skip to content

Instantly share code, notes, and snippets.

@imotov
Created November 22, 2012 12:24
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 imotov/58e7a59e69a39b8d361c to your computer and use it in GitHub Desktop.
Save imotov/58e7a59e69a39b8d361c to your computer and use it in GitHub Desktop.
curl -XDELETE localhost:9200/test-idx
curl -XPUT localhost:9200/test-idx/doc/1 -d '{
"relatedSources": null,
"fetchTimeStamp": "12-08-2012 21:59:42",
"entityCount": 9,
"Categories": {
"Types": {
"Events": [
{
"DateEvent": [
{
"event": "Police said Sunday they approached Darrius Kennedy, 51, while he was smoking what appeared to be marijuana.",
"instance": [
{
"count": 1,
"event": "Police said Sunday they approached Darrius Kennedy, 51, while he was smoking what appeared to be marijuana."
}
]
},
{
"event": "Slideshow NEW YORK | Sun Aug 12, 2012 9:04pm IST NEW YORK (Reuters) - New York City Police shot and killed a knife-wielding suspect as he weaved through Saturday afternoon traffic and pedestrians in New York'\''s Times Square, authorities said.",
"instance": [
{
"count": 1,
"event": "Slideshow NEW YORK | Sun Aug 12, 2012 9:04pm IST NEW YORK (Reuters) - New York City Police shot and killed a knife-wielding suspect as he weaved through Saturday afternoon traffic and pedestrians in New York'\''s Times Square, authorities said."
}
]
}
],
"count": 5,
"event": "DateEvent"
},
{
"count": 2,
"event": "PersonEvent",
"PersonEvent": [
{
"event": "(Reporting By Edith Honan; Editing by Doina Chiacu)",
"instance": [
{
"count": 1,
"event": "(Reporting By Edith Honan; Editing by Doina Chiacu)"
}
]
},
{
"event": "\"He was ordered to put down the knife and he refused,\" said the spokesman, Martin Speechley.",
"instance": [
{
"count": 1,
"event": "\"He was ordered to put down the knife and he refused,\" said the spokesman, Martin Speechley." }
]
}
]
}
]
}
},
"Content": "<div id=\"ace-final-consolidated\"> <div algo-page-number=\"1\" class=\"algo-page-class\"> <span id=\"articleText\" algoscore=\"86.5\"><p>NEW YORK (Reuters) - New York City Police shot and killed a knife-wielding suspect as he weaved through Saturday afternoon traffic and pedestrians in New York'\''s Times Square, authorities said. Police said Sunday they approached Darrius Kennedy, 51,...</p><p>Images from across the country this week.&nbsp; Slideshow&nbsp;</p> <div id=\"articleInfo\" algoscore=\"4.0\"> <p algoscore=\"2.0\"> NEW YORK | Sun Aug 12, 2012 9:04pm IST </p> </div><span class=\"focusParagraph\" algoscore=\"19.0\"><p>NEW YORK (Reuters) - New York City Police shot and killed a knife-wielding suspect as he weaved through Saturday afternoon traffic and pedestrians in New York'\''s Times Square, authorities said.</p></span><p>Police said Sunday they approached Darrius Kennedy, 51, while he was smoking what appeared to be marijuana. He became agitated and confronted the officers with a knife, a police spokesman said.</p><p>&quot;He was ordered to put down the knife and he refused,&quot; said the spokesman, Martin Speechley.</p><p>He added that Kennedy was pepper-sprayed six times but did not respond. After he was again told to drop the knife, two officers fired on him, hitting him in the torso.</p><p>Kennedy was later pronounced dead at a hospital, the spokesman said.</p><p>The incident may stir additional controversy about the city'\''s so-called stop-and-frisk policies, which have been criticized as targeting racial minorities. Kennedy was black. (Reporting By Edith Honan; Editing by Doina Chiacu)</p></span> </div> </div>"
}'
curl -XPOST localhost:9200/test-idx/_refresh
curl localhost:9200/test-idx/_search -d '{
"query": {
"query_string": {
"query": "reporting",
"default_field": "Content"
}
},
"script_fields": {
"entity_facets": {
"script": "result=[];foreach(facet : _source.Categories.Types.Events) {if(facet.event==event) result.add(facet);} result",
"params": {
"event": "AnalystEvent"
}
}
}
}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment