Skip to content

Instantly share code, notes, and snippets.

@loren
Created October 28, 2014 17:32
Show Gist options
  • Save loren/3e81ce2637f9889109b5 to your computer and use it in GitHub Desktop.
Save loren/3e81ce2637f9889109b5 to your computer and use it in GitHub Desktop.
Initial Elasticsearch query across Instagram and Flickr
GET http://localhost:9200/development-asis-flickr_photos,development-asis-instagram_photos/_search
{
"query": {
"function_score": {
"functions": [
{
"field_value_factor": {
"field": "popularity",
"modifier": "log2p"
}
},
{
"gauss": {
"taken_at": {
"scale": "4w"
}
}
}
],
"query": {
"filtered": {
"query": {
"bool": {
"should": [
{
"match": {
"tags": {
"query": "4th of july",
"analyzer": "tag_analyzer"
}
}
},
{
"simple_query_string": {
"fields": [
"title",
"description",
"caption"
],
"query": "4th of july",
"analyzer": "en_analyzer",
"default_operator": "AND"
}
}
]
}
},
"filter": {
"bool": {
"should": [
{
"bool": {
"must": [
{
"term": {
"_type": "flickr_photo"
}
}
],
"should": [
{
"terms": {
"owner": [
"flickr_user_profile_1@n02",
"flickr_user_profile_2@n03"
]
}
},
{
"terms": {
"groups": [
"flickr_group_profile_1@n07"
]
}
}
]
}
},
{
"bool": {
"must": [
{
"terms": {
"username": [
"instagram_username_1",
"instagram_username_2",
"instagram_username_3"
]
}
},
{
"term": {
"_type": "instagram_photo"
}
}
]
}
}
]
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment