Last active
          October 3, 2015 14:07 
        
      - 
      
- 
        Save imotov/2466255 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or 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
    
  
  
    
  | curl -XDELETE http://localhost:9200/twitter | |
| curl -XPUT http://localhost:9200/twitter -d '{ | |
| "settings" : { | |
| "index" : { | |
| "number_of_shards" : 1, | |
| "number_of_replicas" : 1 | |
| } | |
| }, | |
| "mappings" : { | |
| "tweet" : { | |
| "_source" : { "enabled" : false }, | |
| "_id" : { "index": "not_analyzed", "store" : "yes"}, | |
| "properties" : { | |
| "message": { "type": "string", "store": "yes" } | |
| } | |
| } | |
| } | |
| }' | |
| curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '{"message" : "foo"}' | |
| curl -XPUT 'http://localhost:9200/twitter/tweet/2' -d '{"message" : "bar"}' | |
| curl -XPUT 'http://localhost:9200/twitter/tweet/3' -d '{"message" : "baz"}' | |
| curl -XPOST 'http://localhost:9200/twitter/_refresh' | |
| echo | |
| curl -XGET 'http://localhost:9200/twitter/tweet/_search?fields=_id&pretty=true' -d '{ | |
| "query": { | |
| "query_string" : { | |
| "query" : "*:*" | |
| } | |
| }, | |
| "sort" : { | |
| "_script" : { | |
| "script" : "friends_visits_ids.containsKey(_fields._id.value)", | |
| "type" : "string", | |
| "params": { | |
| "friends_visits_ids": { "1" : {}, "2" : {}, "4" : {}} | |
| } | |
| } | |
| } | |
| }' | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment