Guest User

Untitled

a guest
Oct 23rd, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. GET myindex/_search?
  2. {
  3. "size":0,
  4. "query": {
  5. "bool": {
  6. "must": [
  7. { "match": {
  8. "PersonID": "111"
  9. }},
  10. { "match": {
  11. "Month": "5"
  12. }}
  13. ]
  14. } },
  15. "aggs": {
  16. "stay_days": {
  17. "terms" : {
  18. "field": "Month"
  19. }
  20. }
  21. }
  22. }
  23.  
  24. {
  25. "size": 0,
  26. "query": {
  27. "bool": {
  28. "must": [
  29. {
  30. "match": {
  31. "PersonID": "111"
  32. }
  33. },
  34. {
  35. "range": {
  36. "datetime": {
  37. "gte": "2017-05-01",
  38. "lt": "2017-06-01"
  39. }
  40. }
  41. }
  42. ]
  43. }
  44. },
  45. "aggregations": {
  46. "my_day_histogram": {
  47. "date_histogram": {
  48. "field": "datetime",
  49. "interval": "1d",
  50. "min_doc_count": 1
  51. }
  52. }
  53. }
  54. }
  55.  
  56. "aggregations": {
  57. "my_month_histogram": {
  58. "date_histogram": {
  59. "field": "first_timestamp",
  60. "interval": "1M",
  61. "min_doc_count": 1
  62. },
  63. "aggregations": {
  64. "my_day_histogram": {
  65. "date_histogram": {
  66. "field": "first_timestamp",
  67. "interval": "1d"
  68. }
  69. }
  70. }
  71. }
  72. }
Add Comment
Please, Sign In to add comment