Advertisement
Guest User

elasticsearch ordering

a guest
Jan 23rd, 2014
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.09 KB | None | 0 0
  1. curl -XDELETE 'http://localhost:9200/test_search'
  2. curl -XPUT 'http://localhost:9200/test_search/' -d '
  3. {
  4.    "mappings" : {
  5.        "test_record" : {
  6.            "properties" : {
  7.                "name" : {
  8.                    "type" : "string"
  9.                }
  10.            }
  11.        }
  12.    }
  13. }'
  14.  
  15. curl -XPUT 'http://localhost:9200/test_search/test_record/1' -d '{
  16.    "name" : "brown fox jump over the lazy dog quick"
  17. }'
  18.  
  19. curl -XPUT 'http://localhost:9200/test_search/test_record/2' -d '{
  20.    "name" : "brown fox jump over the lazy quick dog"
  21. }'
  22.  
  23. curl -XPUT 'http://localhost:9200/test_search/test_record/3' -d '{
  24.    "name" : "quick brown fox jump over the lazy dog"
  25. }'
  26.  
  27. curl -XGET 'http://localhost:9200/test_search/_search?pretty=true' -d '{
  28.    "query": {
  29.        "bool": {
  30.            "must": [ ],
  31.            "must_not": [ ],
  32.            "should": [
  33.                {
  34.                    "query_string" : {
  35.                        "default_field": "name",
  36.                        "query" : "quick"
  37.                    }
  38.                }
  39.            ]
  40.        }
  41.    }
  42. }'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement