Skip to content

Instantly share code, notes, and snippets.

@danoyoung
Created October 12, 2011 04:08
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 danoyoung/0ea80c38e7ebe89b3314 to your computer and use it in GitHub Desktop.
Save danoyoung/0ea80c38e7ebe89b3314 to your computer and use it in GitHub Desktop.
curl -s -XGET 'http://localhost:9200/daily_ad_network_keywords_2011/daily_ad_network_keyword/_search?pretty=true' -d '
{
"query": {
"filtered": {
"query": {
"bool" : {
"must" : { "field" : { "campaign_group_id" : 187 } },
"must" : { "field" : { "optimizer_id" : 79 } },
"must" : { "field" : { "keyword_id" : 638489 } }
}
},
"filter": {
"numeric_range": { "dw_date_marker_id": { "from": 1022, "to": 1022,"include_lower" : true,"include_upper":true } }
}
}
},
"facets" : {
"actual_click_cost_last_24_hours_stats" : {
"terms_stats" : {
"key_field" : "keyword_id",
"value_field" : "actual_click_cost_last_24_hours"
}
}
}
}'
I've tried this as well
curl -s -XGET 'http://localhost:9200/daily_ad_network_keywords_2011/daily_ad_network_keyword/_search?pretty=true' -d '
{
"query": {
"filtered": {
"query": {
"bool" : {
"must" : { "field" : { "campaign_group_id" : 187 } },
"must" : { "field" : { "optimizer_id" : 79 } },
"must" : { "field" : { "keyword_id" : 638489 } }
}
},
"filter": {
"numeric_range": { "dw_date_marker_id": { "from": 1022, "to": 1022,"include_lower" : true,"include_upper":true } }
}
}
},
"facets" : {
"actual_click_cost_last_24_hours_stats" : {
"terms_stats" : {
"key_field" : "keyword_id",
"value_script" : "doc.actual_click_cost_last_24_hours.doubleValue"
}
}
}
}'
Here's my mapping for the type:
{
"daily_ad_network_keyword" : {
"properties" : {
"average_position" : {
"type" : "double"
},
"impressions_since_baseline" : {
"type" : "long"
},
"conversion_cost_last_24_hours" : {
"type" : "long"
},
"bounce_count_all_time" : {
"type" : "long"
},
"ad_network_cost_last_24_hours" : {
"type" : "long"
},
"keyword_id" : {
"type" : "long"
},
"pending_click_earnings_snapshot" : {
"type" : "double"
},
"effective_click_cost_all_time" : {
"type" : "double"
},
"conversion_cost_since_baseline" : {
"type" : "long"
},
"daily_gross_conversion_earnings" : {
"type" : "long"
},
"entrances_last_24_hours" : {
"type" : "long"
},
"banked_click_earnings_snapshot" : {
"type" : "double"
},
"estimated_first_page_bid" : {
"type" : "long"
},
"ad_group_id" : {
"type" : "long"
},
"actual_click_cost_last_24_hours" : {
"type" : "long"
},
"entrances_all_time" : {
"type" : "long"
},
"advertiser_id" : {
"type" : "long"
},
"entrances_since_baseline" : {
"type" : "long"
},
"conversions_since_baseline" : {
"type" : "long"
},
"conversions_last_24_hours" : {
"type" : "long"
},
"clicks_since_baseline" : {
"type" : "long"
},
"time_on_page_all_time" : {
"type" : "long"
},
"actual_click_cost_since_baseline" : {
"type" : "long"
},
"last_average_position" : {
"type" : "long"
},
"paid_click_earnings_snapshot" : {
"type" : "double"
},
"ad_network_id" : {
"type" : "long"
},
"ad_network_cost_since_baseline" : {
"type" : "double"
},
"bounce_count_since_baseline" : {
"type" : "long"
},
"effective_click_cost_since_baseline" : {
"type" : "double"
},
"actual_click_cost_all_time" : {
"type" : "long"
},
"banked_conversion_earnings_snapshot" : {
"type" : "long"
},
"pending_conversion_earnings_snapshot" : {
"type" : "long"
},
"bounce_count_last_24_hours" : {
"type" : "long"
},
"conversions_all_time" : {
"type" : "long"
},
"dw_date_marker_id" : {
"type" : "long"
},
"last_estimated_first_page_bid" : {
"type" : "long"
},
"ad_network_cost_all_time" : {
"type" : "double"
},
"paid_conversion_earnings_snapshot" : {
"type" : "long"
},
"time_on_page_last_24_hours" : {
"type" : "long"
},
"clicks_all_time" : {
"type" : "long"
},
"optimizer_id" : {
"type" : "long"
},
"daily_gross_click_earnings" : {
"type" : "double"
},
"has_editorial_comment" : {
"type" : "long"
},
"conversion_cost_all_time" : {
"type" : "long"
},
"impressions_last_24_hours" : {
"type" : "long"
},
"impressions_all_time" : {
"type" : "long"
},
"clicks_last_24_hours" : {
"type" : "long"
},
"last_quality_score" : {
"type" : "long"
},
"quality_score" : {
"type" : "long"
},
"campaign_group_id" : {
"type" : "long"
},
"time_on_page_since_baseline" : {
"type" : "long"
},
"effective_click_cost_last_24_hours" : {
"type" : "double"
}
}
}
}
sample data:
{
"advertiser_id": 125,
"optimizer_id": 79,
"ad_network_id": 3,
"campaign_group_id": 187,
"ad_group_id": 12883,
"keyword_id": 638489,
"dw_date_marker_id": 1022,
"has_editorial_comment": 0,
"ad_network_cost_last_24_hours": 2.04,
"effective_click_cost_last_24_hours": 2.28,
"actual_click_cost_last_24_hours": 1.75,
"conversion_cost_last_24_hours": 0,
"impressions_last_24_hours": 6,
"clicks_last_24_hours": 1,
"conversions_last_24_hours": 0,
"time_on_page_last_24_hours": 0,
"bounce_count_last_24_hours": 0,
"entrances_last_24_hours": 0,
"ad_network_cost_since_baseline": 5.22,
"effective_click_cost_since_baseline": 6.84,
"actual_click_cost_since_baseline": 5.25,
"conversion_cost_since_baseline": 0,
"impressions_since_baseline": 30,
"clicks_since_baseline": 3,
"conversions_since_baseline": 0,
"time_on_page_since_baseline": 0,
"bounce_count_since_baseline": 0,
"entrances_since_baseline": 0,
"ad_network_cost_all_time": 6.09,
"effective_click_cost_all_time": 7.77,
"actual_click_cost_all_time": 6.35,
"conversion_cost_all_time": 0,
"impressions_all_time": 48,
"clicks_all_time": 4,
"conversions_all_time": 0,
"time_on_page_all_time": 0,
"bounce_count_all_time": 0,
"entrances_all_time": 0,
"quality_score": 0,
"estimated_first_page_bid": 0,
"average_position": 2,
"pending_click_earnings_snapshot": 0,
"pending_conversion_earnings_snapshot": 0,
"banked_click_earnings_snapshot": 0,
"banked_conversion_earnings_snapshot": 0,
"paid_click_earnings_snapshot": 0.57,
"paid_conversion_earnings_snapshot": 0,
"daily_gross_click_earnings": 0.08,
"daily_gross_conversion_earnings": 0,
"last_quality_score": 0,
"last_estimated_first_page_bid": 0,
"last_average_position": 2
}
{
"advertiser_id": 125,
"optimizer_id": 79,
"ad_network_id": 1,
"campaign_group_id": 187,
"ad_group_id": 12883,
"keyword_id": 638489,
"dw_date_marker_id": 1022,
"has_editorial_comment": 0,
"ad_network_cost_last_24_hours": 1.21,
"effective_click_cost_last_24_hours": 2.28,
"actual_click_cost_last_24_hours": 2.54,
"conversion_cost_last_24_hours": 0,
"impressions_last_24_hours": 28,
"clicks_last_24_hours": 1,
"conversions_last_24_hours": 0,
"time_on_page_last_24_hours": 0,
"bounce_count_last_24_hours": 0,
"entrances_last_24_hours": 0,
"ad_network_cost_since_baseline": 16.66,
"effective_click_cost_since_baseline": 21.99,
"actual_click_cost_since_baseline": 22.83,
"conversion_cost_since_baseline": 0,
"impressions_since_baseline": 459,
"clicks_since_baseline": 11,
"conversions_since_baseline": 0,
"time_on_page_since_baseline": 0,
"bounce_count_since_baseline": 0,
"entrances_since_baseline": 0,
"ad_network_cost_all_time": 18.71,
"effective_click_cost_all_time": 24.17,
"actual_click_cost_all_time": 25.6,
"conversion_cost_all_time": 0,
"impressions_all_time": 535,
"clicks_all_time": 13,
"conversions_all_time": 0,
"time_on_page_all_time": 0,
"bounce_count_all_time": 0,
"entrances_all_time": 0,
"quality_score": 6,
"estimated_first_page_bid": 1.25,
"average_position": 4.6785714286,
"pending_click_earnings_snapshot": 0,
"pending_conversion_earnings_snapshot": 0,
"banked_click_earnings_snapshot": 0,
"banked_conversion_earnings_snapshot": 0,
"paid_click_earnings_snapshot": 2.23,
"paid_conversion_earnings_snapshot": 0,
"daily_gross_click_earnings": 0.26,
"daily_gross_conversion_earnings": 0,
"last_quality_score": 6,
"last_estimated_first_page_bid": 1.25,
"last_average_position": 4.6785714286
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment