Skip to content

Instantly share code, notes, and snippets.

@imotov
Created July 20, 2012 19:58
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/927ce430436ad48dd863 to your computer and use it in GitHub Desktop.
Save imotov/927ce430436ad48dd863 to your computer and use it in GitHub Desktop.
curl -XPUT localhost:9200/john/email/1 -d '{"subject":"BB 11", "create_date": "2012-05-01"}'
curl -XPUT localhost:9200/john/email/2 -d '{"subject":"BB AA", "create_date": "2012-02-18"}'
curl -XPUT localhost:9200/john/email/3 -d '{"subject":"BB 12", "create_date": "2012-06-07"}'
curl -XPUT localhost:9200/john/email/4 -d '{"subject":"CC 11", "create_date": "2012-01-05"}'
curl -XPUT localhost:9200/john/essay/5 -d '{"subject":"BB BB", "create_date": "2012-01-06"}'
curl -XPUT localhost:9200/harry/essay/a -d '{"title":"AA CC", "create_date": "2012-03-08"}'
curl -XPUT localhost:9200/harry/essay/b -d '{"title":"BB CC", "create_date": "2012-07-01"}'
curl -XPUT localhost:9200/harry/essay/c -d '{"title":"DD 11", "create_date": "2012-01-16"}'
curl -XPUT localhost:9200/harry/essay/d -d '{"title":"BB 11", "create_date": "2012-02-01"}'
curl -XPOST localhost:9200/john/_refresh
curl -XPOST localhost:9200/harry/_refresh
echo
curl "localhost:9200/john,harry/_search?pretty=true" -d '{
"query" : {
"bool" : {
"should" : [
{
"indices" : {
"indices" : ["john"],
"query" : {
"filtered" : {
"query" : {
"query_string" : { "query" : "bb" }
},
"filter" : {
"type" : {
"value": "email"
}
}
}
},
"no_match_query" : "none"
}
},
{
"indices" : {
"indices" : ["harry"],
"query" : {
"filtered" : {
"query" : {
"query_string" : { "query" : "cc" }
},
"filter" : {
"type" : {
"value": "essay"
}
}
}
},
"no_match_query" : "none"
}
}
]
}
},
"sort" : ["create_date"]
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment