-
-
Save stevesuo/c86ae9e406cbb0c51279 to your computer and use it in GitHub Desktop.
Corrected code for ElasticSearch 0.16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Below, I'm showing command line in > and log output as $$$$ | |
_______________________________________________________________ | |
>curl -XPUT 'http://localhost:9200/feeds' | |
$$$$ LOG RESPONSE: {"ok":true,"acknowledged":true} | |
>curl -XPUT 'http://localhost:9200/feeds/social/_mapping' -d ' | |
{ | |
\"social\": { | |
\"properties\": { | |
\"category\": { | |
\"type\": \"multi_field\", | |
\"fields\": { | |
\"category\": { | |
\"include_in_all\": false, | |
\"index\": \"not_analyzed\", | |
\"type\": \"string\" | |
}, | |
\"category_index\": { | |
\"include_in_all\": false, | |
\"type\": \"string\" | |
} | |
} | |
} | |
} | |
} | |
}' | |
$$$$ LOG RESPONSE: {"ok":true,"acknowledged":true} | |
>curl -XPUT 'http: //localhost: 9200/_bulk' -d ' | |
{ | |
\"index\": { | |
\"_index\": \"feeds\", | |
\"_type\": \"social\", | |
\"_id\": \"1\" | |
} | |
} | |
{ | |
\"feeds\": { | |
\"category\": \"tweets\", | |
\"source\": \"twitter\", | |
\"author_name\": \"Theia_Mania66 (Chio Rodriguez)\", | |
\"full_text\": \"Rollins and the Phillies can close. Thats why theyve won 4 straight divisions and a title.\" | |
} | |
}' | |
$$$$ LOG RESPONSE: {"took":2,"items":[{"index":{"_index":"feeds","_type":"social","_id":"1","_version":1,"ok":true}}]} | |
>curl -XGET 'http: //localhost:9200/_search' -d ' | |
{ | |
"from": 0, | |
"size" : 50, | |
"query" : { | |
"filtered" : { | |
"query" : { | |
"match_all" : {} | |
}, | |
"filter" : { | |
"bool" : { | |
"must" : [ | |
{ | |
"term" : { | |
"category" : "tweets" | |
} | |
} | |
] | |
} | |
} | |
} | |
} | |
}' | |
$$$$ LOG RESPONSE: {"took":4,"timed_out":false,"_shards":{"total":20,"successful":20,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment