Skip to content

Instantly share code, notes, and snippets.

@imotov
Created April 18, 2013 20:14
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/5415870 to your computer and use it in GitHub Desktop.
Save imotov/5415870 to your computer and use it in GitHub Desktop.
curl -XDELETE localhost:9200/test
curl -XPUT localhost:9200/test -d '{
"mappings": {
"post": {
"_source": {
"enabled": false
},
"properties": {
"date": {
"type": "long",
"store": "yes"
},
"discussion_id": {
"type": "long",
"store": "yes"
},
"message": {
"type": "string"
},
"node": {
"type": "long"
},
"thread": {
"type": "long"
},
"title": {
"type": "string"
},
"user": {
"type": "long",
"store": "yes"
}
}
}
}
}
'
curl -XPUT localhost:9200/test/post/1 -d '{
"user": 123,
"date": 12345
}'
curl -XPUT localhost:9200/test/post/3 -d '{
"user": 12345,
"date": 123
}'
curl -XPOST localhost:9200/test/_refresh
curl -XPOST localhost:9200/test/_search -d '{
"from": 0,
"size": 200,
"sort": [{
"date": {
"order": "desc"
}
}],
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"bool": {
"must": {
"term": {
"post.user": "123"
}
},
"must_not": {
"range": {
"node": {
"from": 100,
"to": 100
}
}
}
}
}
}
}
}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment