curl -XGET 'http://localhost:8080/cal/location/all.gdo'

curl -XDELETE --user admin:bedework 'http://localhost:8080/caldav/public/unbrowsable/submissions/cbey/'

curl -XGET 'http://localhost:9200/bwuserp20180112t215803/_search' -d '{
  "from" : 0,
  "size" : 0,
    "query": {
        "filtered" : {
            "filter" : {
                "term" : { "_type" : "location" }
            }
        }
    }
}
'
curl -XGET 'http://localhost:9200/bwuserp20180112t215803/_search' -d '{
  "from" : 0,
  "size" : 0,
    "query": {
        "filtered" : {
            "filter" : {
                "term" : { "_type" : "category" }
            }
        }
    }
}
'
curl -XGET 'http://localhost:9200/bwuserp20180112t215803/_search' -d '{
  "from" : 0,
  "size" : 0,
    "query": {
        "filtered" : {
            "filter" : {
                "term" : { "_type" : "contact" }
            }
        }
    }
}
'

curl -XGET 'http://10.0.10.93:9200/bwuser/_search' -d '{
    "query": {
        "filtered" : {
            "filter" : {
                "term" : { "_type" : "category" }
            }
        }
    }
}
'

curl -XGET 'http://10.0.11.244:9200/bwuser/_search' -d '{
  "from" : 0,
  "size" : 0,
    "query": {
        "filtered" : {
            "filter" : {
                "term" : { "_type" : "event" }
            }
        }
    }
}
'

curl -XGET 'http://localhost:9200/bwuserp20171014t164029/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 59060,
  "query": {
      "filtered" : {
          "filter" : {
              "exists" : { "field" : "recurrenceId" }
          }
      }
  },
  "fields": ["href"]
}
' >> instances-copy.txt

curl -XGET 'http://localhost:9200/bwuser/_mapping?pretty=true'

{
        "nested" : {
          "query" : {
            "bool" : {
              "must" : [
                {"match" : {"event.xprop.name" : "X-YALE-SUBMITTEDBY"}},
                {"match" : {"event.xprop.value" : "Chris McDaniel"}}
              ]
            }
          },
          "path" : "event.xprop"
        }
      }, 

curl -XGET 'http://localhost:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 30,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "not" : {
          "filter" : {
            "term" : {
              "categories.href" : "/public/.bedework/categories/sys/Ongoing"
            }
          }
        }
      },{
        "nested" : {
          "query" : {
            "bool" : {
              "must" : [
                {"match" : {"xprop.name" : "X-YALE-SUBMITTEDBY"}},
                {"match" : {"xprop.value" : "Chris McDaniel"}}
              ]
            }
          },
          "path" : "event.xprop"
        }
      }, {
        "terms" : {
          "entityType" : [ "event", "todo" ],
          "execution" : "or",
          "_name" : "ff808081-5e8394bb-015e-8394bbd4-00000001"
        }
      }, {
        "range" : {
          "dtstart.utc" : {
            "from" : null,
            "to" : "20171219T050000Z",
            "include_lower" : true,
            "include_upper" : false
          }
        }
      }, {
        "range" : {
          "dtend.utc" : {
            "from" : "20170914T040000Z",
            "to" : null,
            "include_lower" : false,
            "include_upper" : true
          }
        }
      }, {
        "term" : {
          "public" : "true"
        }
      }, {
        "or" : {
          "filters" : [ {
            "not" : {
              "filter" : {
                "term" : {
                  "_type" : "event"
                }
              }
            }
          }, {
            "term" : {
              "instance" : "true"
            }
          }, {
            "term" : {
              "override" : "true"
            }
          }, {
            "and" : {
              "filters" : [ {
                "term" : {
                  "master" : "true"
                }
              }, {
                "term" : {
                  "recurring" : "false"
                }
              } ]
            }
          } ]
        }
      } ],
      "_name" : "AND"
    }
  },
  "fields" : ["xprop.name", "xprop.value"],
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'


curl -XGET 'http://10.0.10.93:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 60,
    "query": {
        "filtered" : {
            "filter" : {
                "term" : { "_type" : "collection" }
            }
        }
    },
    "fields": ["href"]
}
'

        "href" : [ "/public/cals/MainCal/CAL-2c9cb3cd-240867ab-0124-0bdaf468-00000a09.ics" ]
        "href" : [ "/public/cals/MainCal/CAL-2c9cb3cd-240867ab-0124-0bdaf468-00000a09.ics" ]
        "href" : [ "/public/cals/MainCal/CAL-2c9cb3cd-240867ab-0124-0bdaf468-00000a09.ics" ]


curl -XGET 'http://localhost:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 60,
    "query": {
        "bool" : {
            "must" : [
              {
                "term" : { "_type" : "event" }
              },
              {
                "term" : { "href" : "/public/cals/MainCal/CAL-ff808081-610812a5-0161-0ae89a4e-00007093.ics" }
              }
            ]
        }
    }
}
'




https://calendar-dev.yale.edu/cal/event/eventView.do?b=de&href=/public/cals/MainCal/CAL-ff808081-5d77e1b0-015d-7b536e36-00006f1a.ics



curl -XGET 'http://10.0.11.244:9200/bwuserp20180112t215803/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 60,
    "query": {
        "bool" : {
            "must" : [
              {
                "term" : { "_type" : "collection" }
              },
              {
                "prefix" : { "href" : "/public/Aliases/Group/Yale Arts/Art" }
              }
            ]
        }
    }
}
'

bwuserp20171007t224319
bwuserp20180112t215803
bwuserp20180116t221811
bwuserp20180119t170107

curl -XGET 'http://10.0.10.93:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 60,
    "query": {
        "bool" : {
            "must" : [
              {
                "term" : { "_type" : "collection" }
              },
              {
                "prefix" : { "href" : "/user/agrp_afam" }
              }
            ]
        }
    }
}
'

curl -XGET 'http://localhost:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 60,
    "query": {
        "filtered" : {
            "filter" : {
                "term" : { "_type" : "collection" }
            }
        }
    },
    "fields": ["href"]
}
'

curl -XGET 'http://localhost:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 60,
    "query": {
        "bool" : {
            "must" : [
              {
                "term" : { "_type" : "collection" }
              },
              {
                "prefix" : { "href" : "/public/" }
              }
            ]
        }
    }
}
'

curl -XGET 'http://10.0.10.93:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 60,
    "query": {
        "bool" : {
            "must" : [
              {
                "term" : { "_type" : "collection" }
              },
              {
                "prefix" : { "href" : "/public/unb" }
              }
            ]
        }
    }
}
'

curl -XGET 'http://10.0.10.93:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 2,
    "query": {
        "bool" : {
            "must" : [
              {
                "term" : { "_type" : "collection" }
              }
            ]
        }
    }
}
'

curl -XGET 'http://10.0.10.93:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 2,
    "query": {
        "bool" : {
            "must" : [
              {
                "term" : { "_type" : "category" }
              }
            ]
        }
    }
}
'

curl -XGET 'http://10.0.10.93:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 2,
    "query": {
        "bool" : {
            "must" : [
              {
                "term" : { "_type" : "contact" }
              }
            ]
        }
    }
}
'

curl -XGET 'http://localhost:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 60,
    "query": {
        "bool" : {
            "must" : [
              {
                "term" : { "_type" : "collection" }
              },
              {
                "term" : { "href" : "/public/cal/MainCal/CAL-ff808081-5a13bb18-015a-162ae0d8-000045bc.ics" }
              }
            ]
        }
    }
}
'
http://sdpl.bwcs-hosting.com/cal/event/eventView.do?b=de&calPath=%2Fpublic%2Fcals%2FMainCal&guid=CAL-ff808081-5a32a309-015a-34302e45-000075ecdemobedework@mysite.edu&recurrenceId=

http://sdpl.bwcs-hosting.com/cal/event/eventView.do?b=de&calPath=%2Fpublic%2Fcals%2FMainCal&guid=CAL-ff808081-5a47609e-015a-48c72592-00003a60demobedework@mysite.edu&recurrenceId=

curl -XGET 'http://localhost:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 60,
    "query": {
        "filtered" : {
            "filter" : {
                "prefix" : { "uid" : "CAL-ff808081-60946e69-0160-946f3dfc-00000009" }
              }
        }
    }
}
'

http://localhost:8080/caladmin/event/fetchForUpdate.do?b=de&calPath=%2Fpublic%2Fcals%2FMainCal&guid=CAL-ff808081-60946e69-0160-946f3dfc-00000009demobedework@mysite.edu&recurrenceId=

curl -XGET 'http://10.0.10.93:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 10,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "colPath" : "/public/cals/MainCal",
          "_name" : "ff808081-5edc1a97-015e-e07a2f29-00004f43"
        }
      }, {
         "term" : {
           "master" : "true"
         }
       } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'

curl -XGET 'http://localhost:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 10,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "colPath" : "/public/unbrowsable/submissions/afam"
        }
      }, {
         "term" : {
           "master" : "true"
         }
       } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'

/public/unbrowsable/submissions/afam

curl -XGET 'http://localhost:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 200,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "colPath" : "/public/cals/orgSync"
        }
      }, {
         "term" : {
           "master" : "true"
         }
       } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}' > orgsync.json


curl -XGET 'localhost:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 60,
    "query": {
        "filtered" : {
            "filter" : {
                "term" : { "topicalArea" : "\t/public/aliases/Event Format/Classes, Demonstrations and Workshops" }
              }
        }
    }
}
'

curl -XGET 'localhost:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 60,
    "query": {
        "filtered" : {
            "filter" : {
                "term" : { "creatorHref" : "/principals/users/agrp_opa" }
              }
        }
    }
}
'

CAL-2c9cb3cd-3728960f-0137-79f6b7c8-00004e5e.ics


curl -XGET 'http://10.0.7.20:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 60,
    "query": {
        "filtered" : {
            "filter" : {
                "prefix" : { "uid" : "CAL-2c9cb3cd-3728960f-0137-79f6b7c8-00004e5ebedework@yale.edu" }
              }
        }
    }
}
'


curl -XGET 'http://10.0.10.93:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 67,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "topicalArea" : "\t/user/agrp_opa/Tours/Museum"
        }
      }, {
        "term" : {
          "public" : "true"
        }
      }, {
        "or" : {
          "filters" : [ {
            "not" : {
              "filter" : {
                "term" : {
                  "_type" : "event"
                }
              }
            }
          }, {
            "term" : {
              "master" : "true"
            }
          } ]
        }
      } ]
    }
  }
}'


curl -XGET 'http://localhost:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 67,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "topicalArea" : "\t/user/agrp_opa/Tours/Museum"
        }
      }, {
        "term" : {
          "public" : "true"
        }
      }, {
        "or" : {
          "filters" : [ {
            "not" : {
              "filter" : {
                "term" : {
                  "_type" : "event"
                }
              }
            }
          }, {
            "term" : {
              "master" : "true"
            }
          } ]
        }
      } ]
    }
  }
}'


curl -XGET 'http://localhost:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 60,
    "query": {
        "bool" : {
            "must" : [
              {
                "term" : { "_type" : "collection" }
              },
              {
                "term" : { "name" : "Series" }
              }
            ]
        }
    }
}
'


curl -XGET 'http://localhost:9200/bwuser/_search?pretty=true' -d '{
    "query": {
        "filtered" : {
            "filter" : {
                "term" : { "_type" : "collection" }
            }
        }
    }
}
'

curl -XOPTIONS 'http://localhost:8080/pubcaldav' --header 'SERVER-INFO-TOKEN: *'

curl -XGET 'http://localhost:9200/bwpublic/_search' -d '{
    "query": {
        "query_string" : {
            "query" : "my"
        }
    }
}
'


curl -XGET 'http://10.0.6.156:9300/bwpublic/_search' -d '{
    "query": {
        "query_string" : {
            "query" : "my"
        }
    }
}
'

curl -XGET 'http://localhost:9200/categories/_search?pretty=true' -d '{
  "size" : 10000,
       "_source": ["href"],
    "query": {
    "wildcard": {
       "href": {
          "value": "/Games/Video_Games/Action*"
       }
    }
    },
  "post_filter" : {
            "range" : {
                "hrefDepth" : {
                    "lte": 6
                }
            }
      }
  }
}
'

curl -XGET 'http://localhost:9200/categories/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 60,
"query": {
    "wildcard": {
       "href": {
          "value": "*/Teams"
       }
    }
},
   "fields": ["href"]
}'


curl -XGET 'http://localhost:9200/categories/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 10,
  "query" : {
    "bool" : {
      "should" : {
        "match" : {
          "href.autocat" : {
            "query" : "baseball"
          }
        }
      }
    }
  },
  "fields" : [ "catName", "href" ]
}'


curl -XGET 'http://localhost:9200/categories/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 10,
  "_source": false,
  "query" : {
    "function_score": {
      "query" : {
        "bool" : {
          "should" : {
            "match" : {
              "catName.autocat" : {
                "query" : "baseball"
              }
            }
          }
          }
        },
        "functions": [
            {
                "filter": {
                    "term" : {
                      "catName" : "Baseball"
                    }
                },
                "weight": 30
            }
        ]
    }
  },
     "post_filter" : {
       "or" : {
         "filters" : [ {
           "term" : {
             "auto" : "true"
           }
         } ]
       }
     },
  "fields" : [ "catName", "href" ]

}'

curl -XGET 'http://localhost:9200/categories/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 10,
  "_source": false,
  "query" : {
    "function_score": {
      "query" : {
        "bool" : {
          "should" : {
            "match" : {
              "catName.autocat" : {
                "query" : "baseball"
              }
            }
          }
          }
        },
        "functions": [
            {
                "filter": {
                    "term" : {
                      "catName" : "Baseball"
                    }
                },
                "weight": 30
            },
            {
            "field_value_factor": {
              "field": "hrefDepth",
              "factor": 10,
              "modifier": "reciprocal"
            }
            }
        ]
    }
  },
     "post_filter" : {
       "or" : {
         "filters" : [ {
           "term" : {
             "auto" : "true"
           }
         } ]
       }
     },
  "fields" : [ "catName", "href" ]

}'

curl -XGET 'http://localhost:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 13,
  "post_filter" : {
    "or" : {
      "filters" : [ {
        "term" : {
          "href" : "/user/schwag/calendar/F5B811E00073B22BA6B87551-1.ics"
        }
      }, {
        "term" : {
          "href" : "/user/schwag/calendar/F5B811E00073B22BA6B87551-7.ics"
        }
      }, {
        "term" : {
          "href" : "/user/schwag/calendar/F5B811E00073B22BA6B87551-8.ics"
        }
      } ]
    }
  }
}'

curl -XGET 'http://localhost:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 3,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "or" : {
          "filters" : [ {
            "term" : {
              "href" : "/user/schwag/calendar/F5B811E00073B22BA6B87551-1.ics"
            }
          }, {
            "term" : {
              "href" : "/user/schwag/calendar/F5B811E00073B22BA6B87551-7.ics"
            }
          }, {
            "term" : {
              "href" : "/user/schwag/calendar/F5B811E00073B22BA6B87551-8.ics"
            }
          } ]
        }
      }, {
        "or" : {
          "filters" : [ {
            "term" : {
              "master" : "true"
            }
          }, {
            "term" : {
              "override" : "true"
            }
          } ]
        }
      } ]
    }
  }
}'

curl -XGET 'http://10.0.6.156:9200/bwpublic/_search' -d '{
  "from" : 0,
  "size" : 0,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "colPath" : "/public/unbrowsable/submissions/submissions"
        }
      }, {
        "terms" : {
          "_type" : [ "event", "todo" ],
          "execution" : "or"
        }
      }, {
        "range" : {
          "dtstart.utc" : {
            "from" : null,
            "to" : "20150907T040000Z",
            "include_lower" : true,
            "include_upper" : false
          }
        }
      }, {
        "range" : {
          "dtend.utc" : {
            "from" : "20150603T040000Z",
            "to" : null,
            "include_lower" : false,
            "include_upper" : true
          }
        }
      }, {
        "or" : {
          "filters" : [ {
            "not" : {
              "filter" : {
                "term" : {
                  "_type" : "event"
                }
              }
            }
          }, {
            "term" : {
              "instance" : "true"
            }
          }, {
            "term" : {
              "override" : "true"
            }
          }, {
            "and" : {
              "filters" : [ {
                "term" : {
                  "master" : "true"
                }
              }, {
                "term" : {
                  "recurring" : "false"
                }
              } ]
            }
          } ]
        }
      } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'

curl -XGET 'http://localhost:9200/bwpublic/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 110,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "name" : "20160325-000021-MAINLIBRARY-201606221030@LIBRARY.NASHVILLE.ORG.ics"
        }
      } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'

curl -XGET 'http://localhost:9200/bwpublic/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 0,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "prefix" : {"dtstart.local" : "20160622T"}
      } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'


curl -XGET 'http://localhost:9200/bwuser/_search' -d '{
    "query": {
        "filtered" : {
            "query" : {
                "query_string" : {
                    "query" : "some query string here"
                }
            },
            "filter" : {
                "term" : { "user" : "kimchy" }
            }
        }
    }
}
'


curl -X PUT http://localhost:8080/ucaldav/user/douglm/calendar/CAL-123459.ics -u douglm:bedework -H "Content-Type: application/calendar+json" -H "Prefer: return=representation" -H "Accept: text/calendar" -d '
[ "vcalendar",
  [
    [ "prodid", { }, "text", "//Bedework.org//BedeWork V3.9//EN" ],
    [ "version", { }, "text", "2.0" ]
  ],
  [
    [ "vevent",
      [
        [ "duration", { }, "duration", "PT1H" ],
        [ "dtstart", {"tzid" : "America/New_York"}, "date", "2013-09-28T11:00:00" ],
        [ "summary", { }, "text", "Try PUT with jcal" ],
        [ "uid", { }, "text", "CAL-ff808081-4131b4e6-0141-31b542f2-123459demobedework@mysite.edu" ]
      ],
      [ ]
    ]
  ]
]
'

wget --header='Accept: application/calendar+json' --http-user=douglm --http-password=bedework http://localhost:8080/ucaldav/user/douglm/calendar/CAL-123456.ics
--2013-09-19 21:11:05--  http://localhost:8080/ucaldav/user/douglm/calendar/CAL-123456.ics
2013-09-19 21:11:06 (79.4 MB/s) - ‘CAL-123456.ics’ saved [586/586]

douglm@douglm-laptop:quickstart-3.10$ more CAL-123456.ics
[ "vcalendar", [ [ "prodid", { }, "text", "//Bedework.org//BedeWork V3.9//EN" ], [ "version", { }, "text", "2.0" ] ], [ [ "vevent", [
[ "created", { }, "date-time", "2013-09-20T01:09:32Z" ], [ "duration", { }, "duration", "PT1H" ], [ "dtstamp", { }, "date-time", "2013
-09-20T01:09:32Z" ], [ "dtstart", {
  "tzid" : "America/New_York"
}, "date", "2013-09-20T11:00:00" ], [ "last-modified", { }, "date-time", "2013-09-20T01:09:32Z" ], [ "summary", { }, "text", "Try PUT
with jcal" ], [ "uid", { }, "text", "CAL-ff808081-4131b4e6-0141-31b542f2-123456demobedework@mysite.edu" ] ], [ ] ] ] ]
douglm@douglm-laptop:quickstart-3.10$

wget  --http-user=douglm --http-password=bedework http://localhost:8080/ucaldav/user/douglm/calendar/CAL-123456.ics
--2013-09-19 21:11:58--  http://localhost:8080/ucaldav/user/douglm/calendar/CAL-123456.ics
2013-09-19 21:11:58 (399 MB/s) - ‘CAL-123456.ics.1’ saved [5460/5460]

douglm@douglm-laptop:quickstart-3.10$ more CAL-123456.ics.1
BEGIN:VCALENDAR
PRODID://Bedework.org//BedeWork V3.9//EN
VERSION:2.0
BEGIN:VTIMEZONE
...
END:VTIMEZONE
BEGIN:VEVENT
CREATED:20130920T010932Z
DURATION:PT1H
DTSTAMP:20130920T010932Z
DTSTART;TZID=America/New_York:20130920T110000
LAST-MODIFIED:20130920T010932Z
SUMMARY:Try PUT with jcal
UID:CAL-ff808081-4131b4e6-0141-31b542f2-123456demobedework@mysite.edu
END:VEVENT
END:VCALENDAR

---------------------------------------------------

at dev.bedework

curl -X PUT http://dev.bedework.org/ucaldav/user/douglm/calendar/CAL-123456.ics -u testuser01:bedework -H "Content-Type: application/calendar+json" -d '
[ "vcalendar",
  [
    [ "prodid", { }, "text", "//Bedework.org//BedeWork V3.9//EN" ],
    [ "version", { }, "text", "2.0" ]
  ],
  [
    [ "vevent",
      [
        [ "duration", { }, "duration", "PT1H" ],
        [ "dtstart", {"tzid" : "America/New_York"}, "date", "2013-09-20T11:00:00" ],
        [ "summary", { }, "text", "Try PUT with jcal" ],
        [ "uid", { }, "text", "CAL-ff808081-4131b4e6-0141-31b542f2-123456demobedework@mysite.edu" ]
      ],
      [ ]
    ]
  ]
]
'

wget --header='Accept: application/calendar+json' --http-user=douglm --http-password=bedework http://localhost:8080/ucaldav/user/douglm/calendar/CAL-123456.ics
--2013-09-19 21:11:05--  http://localhost:8080/ucaldav/user/douglm/calendar/CAL-123456.ics
2013-09-19 21:11:06 (79.4 MB/s) - ‘CAL-123456.ics’ saved [586/586]

douglm@douglm-laptop:quickstart-3.10$ more CAL-123456.ics
[ "vcalendar", [ [ "prodid", { }, "text", "//Bedework.org//BedeWork V3.9//EN" ], [ "version", { }, "text", "2.0" ] ], [ [ "vevent", [
[ "created", { }, "date-time", "2013-09-20T01:09:32Z" ], [ "duration", { }, "duration", "PT1H" ], [ "dtstamp", { }, "date-time", "2013
-09-20T01:09:32Z" ], [ "dtstart", {
  "tzid" : "America/New_York"
}, "date", "2013-09-20T11:00:00" ], [ "last-modified", { }, "date-time", "2013-09-20T01:09:32Z" ], [ "summary", { }, "text", "Try PUT
with jcal" ], [ "uid", { }, "text", "CAL-ff808081-4131b4e6-0141-31b542f2-123456demobedework@mysite.edu" ] ], [ ] ] ] ]
douglm@douglm-laptop:quickstart-3.10$

wget  --http-user=douglm --http-password=bedework http://localhost:8080/ucaldav/user/douglm/calendar/CAL-123456.ics
--2013-09-19 21:11:58--  http://localhost:8080/ucaldav/user/douglm/calendar/CAL-123456.ics
2013-09-19 21:11:58 (399 MB/s) - ‘CAL-123456.ics.1’ saved [5460/5460]

douglm@douglm-laptop:quickstart-3.10$ more CAL-123456.ics.1
BEGIN:VCALENDAR
PRODID://Bedework.org//BedeWork V3.9//EN
VERSION:2.0
BEGIN:VTIMEZONE
...
END:VTIMEZONE
BEGIN:VEVENT
CREATED:20130920T010932Z
DURATION:PT1H
DTSTAMP:20130920T010932Z
DTSTART;TZID=America/New_York:20130920T110000
LAST-MODIFIED:20130920T010932Z
SUMMARY:Try PUT with jcal
UID:CAL-ff808081-4131b4e6-0141-31b542f2-123456demobedework@mysite.edu
END:VEVENT
END:VCALENDAR

---------------------------------------
curl -X PUT http://localhost:8080/ucaldav/user/douglm/calendar/CAL-123456.ics -u douglm:bedework -H "Content-Type: application/calendar+json" -d '
[ "vcalendar",
  [
    [ "prodid", { }, "text", "//Bedework.org//BedeWork V3.9//EN" ],
    [ "version", { }, "text", "2.0" ]
  ],
  [
    [ "vevent",
      [
        [ "duration", { }, "duration", "PT1H" ],
        [ "dtstart", {"tzid" : "America/New_York"}, "date", "2013-09-20T11:00:00" ],
        [ "summary", { }, "text", "Try PUT with jcal" ],
        [ "uid", { }, "text", "CAL-ff808081-4131b4e6-0141-31b542f2-123456demobedework@mysite.edu" ]
      ],
      [ ]
    ]
  ]
]
'

----------------------------------------------------------

POST for freebusy


curl -X POST http://localhost:8080/ucaldav/user/testuser01/Outbox/ -u douglm:bedework -H "Content-Type: application/calendar+json; charset=UTF-8" -d '
["vcalendar",
  [
    ["version",{},"text","2.0"],
    ["prodid",{},"text","-//calendarserver.org//jcal v1//EN"],
    ["method",{},"text","REQUEST"]
  ],
  [
    ["vfreebusy",
      [
        ["uid",{},"text","01ACF71A-6F7D-484C-64AB-C13BB517D0BA"],
        ["dtstamp",{},"date-time","2013-09-18T20:42:02Z"],
        ["organizer",{"cn":"User 01"},"cal-address","mailto:testuser01@mysite.edu"],
        ["attendee",{},"cal-address","mailto:douglm@mysite.edu"],
        ["dtstart",{},"date-time","2013-09-20T16:00:00Z"],
        ["dtend",{},"date-time","2013-09-27T17:00:00Z"]
      ],
      []
    ]
  ]
]
'

[ "vcalendar",
  [
    [ "prodid", { }, "text", "//Bedework.org//BedeWork V3.9//EN" ],
    [ "version", { }, "text", "2.0" ]
  ],
  [
    [ "vfreebusy",
      [
        [ "dtstamp", { }, "date-time", "2013-09-23T08:20:09Z" ],
        [ "dtstart", { }, "date", "2013-09-20T16:00:00Z" ],
        [ "dtend", { }, "date", "2013-09-27T17:00:00Z" ],
        [ "attendee", { }, "cal-address", "mailto:douglm@mysite.edu" ],
        [ "organizer", {"cn" : "User 01"}, "cal-address", "mailto:testuser01@mysite.edu" ],
        [ "uid", { }, "text", "01ACF71A-6F7D-484C-64AB-C13BB517D0BA" ]
      ],
      [ ]
    ]
  ]
]

----------------------------------------------------------

From Philipp

curl -X PUT http://localhost:8080/ucaldav/user/douglm/calendar/8132eb5d-e620-2742-8e80-bc487409b367.ics -u douglm:bedework -H "Content-Type: application/calendar+json" -d '
["vcalendar",
  [
    ["prodid",{},"text","-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN"],
    ["version",{},"text","2.0"]
  ],
  [
    ["vtimezone",
      [
        ["tzid",{},"text","Europe/Berlin"],
        ["x-lic-location",{},"text","Europe/Berlin"]
      ],
      [
        ["daylight",
          [
            ["tzoffsetfrom",{},"utc-offset","+01:00"],
            ["tzoffsetto",{},"utc-offset","+02:00"],
            ["tzname",{},"text","CEST"],
            ["dtstart",{},"date-time","1970-03-29T02:00:00"],
            ["rrule",{},"recur",{"freq":"YEARLY","byday":["-1SU"],"bymonth":[3]}]
          ],
          []
        ],
        ["standard",
          [
            ["tzoffsetfrom",{},"utc-offset","+02:00"],
            ["tzoffsetto",{},"utc-offset","+01:00"],
            ["tzname",{},"text","CET"],
            ["dtstart",{},"date-time","1970-10-25T03:00:00"],
            ["rrule",{},"recur",{"freq":"YEARLY","byday":["-1SU"],"bymonth":[10]}]
          ],
          []
        ]
      ]
    ],
    ["vevent",
      [
        ["created",{},"date-time","2013-09-23T08:28:47Z"],
        ["last-modified",{},"date-time","2013-09-23T08:28:47Z"],
        ["dtstamp",{},"date-time","2013-09-23T08:28:47Z"],
        ["uid",{},"text","8132eb5d-e620-2742-8e80-bc487409b367"],
        ["summary",{},"text","New Event"],
        ["dtstart",{"tzid":"Europe/Berlin"},"date-time","2013-09-24T09:00:00"],
        ["dtend",{"tzid":"Europe/Berlin"},"date-time","2013-09-24T14:00:00"]
      ],
      []
    ]
  ]
]
'

---------------------------------------

curl -X REPORT http://localhost:8080/ucaldav/user/douglm/ -u douglm:bedework  -d '
<C:calendar-multiget xmlns:D="DAV:"
                     xmlns:C="urn:ietf:params:xml:ns:caldav">
  <D:prop>
    <D:getetag/>
    <C:calendar-data content-type="application/calendar+json"/>
  </D:prop>
  <D:href>/ucaldav/user/douglm/calendar/8132eb5d-e620-2742-8e80-bc487409b367.ics</D:href>
</C:calendar-multiget>'

------------------------------------------

curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "query": {
    "query_string" : {
    "query" : "parrots"
    }
  },
  "filter": {
              "range" : {
                "end_utc" : {
                  "from" : "20131003T000000Z",
                  "to" : null,
                  "include_lower" : true,
                  "include_upper" : true
                }
              }
            },
  "from": 0,
  "size": 10
}'

curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "query": {
    "query_string" : {
    "query" : "parrots"
    }
  },
  "from": 0,
  "size": 10
}'


curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "query" : {
    "query_string" : {
      "query" : "parrots"
    }
  },
  "filter" : {
    "and" : {
      "filters" : [ {
        "and" : {
          "filters" : [ {
            "term" : {
              "_type" : "event"
            }
          }, {
            "term" : {
              "category_path" : "/public/categories/Films"
            }
          } ]
        }
      }, {
        "range" : {
          "end_utc" : {
            "from" : "20131003T000000Z",
            "to" : null,
            "include_lower" : true,
            "include_upper" : true
          }
        }
      } ]
    }
  },
  "facets" : {
    "category_path" : {
      "terms" : { "field" : "category_uid" },
      "global" : true,
      "facet_filter" : {
        "term" : { "_type" : "event"}
      }
    }
  }
}'

curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
    "query": {
      "match_all": {}
    },
    "filter": {
        "term" : {
          "_type" : "event"
        }
    }
}'

curl -XGET 'http://localhost:9200/bwuser/_search?pretty=true' -d '{
  "size" : 1000,
    "query": {
      "match_all": {}
    },
  "fields": ["_type", "colPath"]
}
'

curl -XGET 'http://localhost:9200/bwuser/_search?pretty=true' -d '{
  "size" : 1000,
    "query": {
        "filtered" : {
            "filter" : {
                "term" : { "_type" : "vpoll" }
            }
        }
    },
  "fields": ["_type", "voter"]
}
'

curl -XGET 'http://localhost:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 10,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "_type" : "vpoll"
        }
      }, {
        "term" : {
          "colPath" : "/user/agrp_Library/Event Category"
        }
      } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}
'

curl -XGET 'http://localhost:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 10,
  "post_filter" : {
        "term" : {
          "_type" : "vpoll"
        }
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}
'

curl -XGET 'http://localhost:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 10,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "_type" : "vpoll"
        }
      } ]
    }
  },
  "fields": ["colPath", "voter"],
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}
'

curl -XPOST 'http://localhost:9200/bwuser/updateTracker/updateTracker/_update' -d '{
     "script": "ctx._source.count += 1"
     }'

curl -XPOST 'http://localhost:9200/bwuser/updateTracker/updateTracker/_update' -d '{
     "script": "ctx._source.count = 1"
     }'

curl -X GET 'localhost:9200/bwuser/_search?pretty=true' -d'
{
    "query": {
      "match_all": {}
    },
    "filter": {
        "term" : {
          "_type" : "updateTracker"
        }
    }
}'

curl -X GET 'http://localhost:9200/bwuser/updateTracker/updateTracker?pretty=true'

curl -X GET 'localhost:8080/cal/search/search.rdo?query=parrots&submit=search&filter=((entity_type="event")%26(category_path="/public/categories/Films"))'

curl -X POST 'localhost:8080/cal/search/search.rdo' --form'
query=parrots
submit=search
filter=((entity_type=event) & (category_path="/public/categories/Films"))
'

--------------------------------------------------------------------
query from test system


curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "size" : 100,
  "filter" : {
    "and" : {
      "filters" : [ {
        "and" : {
          "filters" : [ {
            "term" : {
              "path" : "/public/cals/MainCal"
            }
          }, {
            "terms" : {
              "category_uid" :  [ "ff808181-1fd7389e-011f-d7389f9a-00000026", "ff808181-1fd7389e-011f-d7389ed0-00000002", "ff808181-1fd7389e-011f-d7389ef9-00000003", "ff808181-1fd7389e-011f-d7389eff-00000004", "ff808181-1fd7389e-011f-d7389f02-00000005", "ff808181-1fd7389e-011f-d7389f15-0000000a", "ff808181-1fd73b03-011f-d73b065c-00000002", "ff808181-1fd7389e-011f-d7389f24-0000000e", "402881e6-20a21413-0120-a23d71e5-00000015", "ff808181-1fd7389e-011f-d7389f33-00000012", "ff808181-1fd7389e-011f-d7389f8b-00000022", "ff808181-1fd7389e-011f-d7389f38-00000013", "ff808181-1fd7389e-011f-d7389f3f-00000015", "402881e6-20a21413-0120-a24c742e-00000058", "402881e6-20a21413-0120-a248f865-00000020", "402881e6-20a21413-0120-a24bfbc2-00000057", "402881e6-20a21413-0120-a24bc8db-00000056", "ff808181-1fd7389e-011f-d7389f0a-00000007", "ff808181-1fd7389e-011f-d7389f1c-0000000c", "ff808181-1fd73b03-011f-d73b06f8-0000000c", "ff808181-1fd7389e-011f-d7389f8f-00000023", "ff808181-1fd7389e-011f-d7389ec8-00000000", "ff808181-1fd7389e-011f-d7389f06-00000006", "ff808181-1fd7389e-011f-d7389f0d-00000008", "ff808181-1fd7389e-011f-d7389f59-0000001c", "ff808181-1fd7389e-011f-d7389f18-0000000b", "402881e6-20a21413-0120-a236d0b1-00000014", "ff808181-1fd7389e-011f-d7389f28-0000000f", "ff808181-1fd7389e-011f-d7389f88-00000021", "ff808181-1fd7389e-011f-d7389fa2-00000028", "ff808181-1fd7389e-011f-d7389fa5-00000029", "ff808181-1fd7389e-011f-d7389f96-00000025", "402881e6-20a21413-0120-a22de2dd-0000000d", "402881e6-20a21413-0120-a22fdf78-00000010", "ff808181-1fd73b03-011f-d73b0714-0000000e", "ff808181-1fd7389e-011f-d7389f80-0000001f", "ff808181-1fd7389e-011f-d7389f60-0000001e", "ff808181-1fd73b03-011f-d73b071a-0000000f", "ff808181-1fd7389e-011f-d7389f84-00000020", "ff808181-1fd7389e-011f-d7389fa9-0000002a", "ff808181-1fd7389e-011f-d7389f20-0000000d", "ff808181-1fd7389e-011f-d7389f4f-00000019", "ff808181-1fd7389e-011f-d7389fad-0000002b", "ff808181-1fd7389e-011f-d7389f2c-00000010", "ff808181-1fd7389e-011f-d7389f3b-00000014", "ff808181-1fd7389e-011f-d7389f4b-00000018", "ff808181-1fd7389e-011f-d7389ecc-00000001", "ff808181-1fd7389e-011f-d7389f30-00000011", "ff808181-1fd7389e-011f-d7389f47-00000017", "00f1fcb8-20a0fb67-0120-a144373f-000001ed" ] ,
              "execution" : "or"
            }
          } ]
        }
      }, {
        "range" : {
          "end_utc" : {
            "from" : "20131010T040000Z",
            "to" : null,
            "include_lower" : true,
            "include_upper" : true
          }
        }
      }, {
        "range" : {
          "start_utc" : {
            "from" : null,
            "to" : "20131110T050000Z",
            "include_lower" : true,
            "include_upper" : false
          }
        }
      } ]
    }
  }
}'

curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "size" : 100,
  "query": {
    "match_all": {}
  },
  "filter": {
    "term" : {"_type" : "event"}
  },
  "fields": ["start_utc", "summary", "recurrenceid", "uid"]
}'

curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "size" : 100,
  "query": {
    "match_all": {}
  }
}'

curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "from" : 0,
  "filter" : {
    "and" : {
      "filters" : [ {
        "and" : {
          "filters" : [ {
            "and" : {
              "filters" : [ {
                "term" : {
                  "path" : "/public/cals/MainCal"
                }
              }, {
                "terms" : {
                  "category_uid" : [ "ff808181-1fd7389e-011f-d7389f9a-00000026", "ff808181-1fd7389e-011f-d7389ed0-00000002", "ff808181-1fd7389e-011f-d7389ef9-00000003", "ff808181-1fd7389e-011f-d7389eff-00000004", "ff808181-1fd7389e-011f-d7389f02-00000005", "ff808181-1fd7389e-011f-d7389f15-0000000a", "ff808181-1fd73b03-011f-d73b065c-00000002", "ff808181-1fd7389e-011f-d7389f24-0000000e", "402881e6-20a21413-0120-a23d71e5-00000015", "ff808181-1fd7389e-011f-d7389f33-00000012", "ff808181-1fd7389e-011f-d7389f8b-00000022", "ff808181-1fd7389e-011f-d7389f38-00000013", "ff808181-1fd7389e-011f-d7389f3f-00000015", "402881e6-20a21413-0120-a24c742e-00000058", "402881e6-20a21413-0120-a248f865-00000020", "402881e6-20a21413-0120-a24bfbc2-00000057", "402881e6-20a21413-0120-a24bc8db-00000056", "ff808181-1fd7389e-011f-d7389f0a-00000007", "ff808181-1fd7389e-011f-d7389f1c-0000000c", "ff808181-1fd73b03-011f-d73b06f8-0000000c", "ff808181-1fd7389e-011f-d7389f8f-00000023", "ff808181-1fd7389e-011f-d7389ec8-00000000", "ff808181-1fd7389e-011f-d7389f06-00000006", "ff808181-1fd7389e-011f-d7389f0d-00000008", "ff808181-1fd7389e-011f-d7389f59-0000001c", "ff808181-1fd7389e-011f-d7389f18-0000000b", "402881e6-20a21413-0120-a236d0b1-00000014", "ff808181-1fd7389e-011f-d7389f28-0000000f", "ff808181-1fd7389e-011f-d7389f88-00000021", "ff808181-1fd7389e-011f-d7389fa2-00000028", "ff808181-1fd7389e-011f-d7389fa5-00000029", "ff808181-1fd7389e-011f-d7389f96-00000025", "402881e6-20a21413-0120-a22de2dd-0000000d", "402881e6-20a21413-0120-a22fdf78-00000010", "ff808181-1fd73b03-011f-d73b0714-0000000e", "ff808181-1fd7389e-011f-d7389f80-0000001f", "ff808181-1fd7389e-011f-d7389f60-0000001e", "ff808181-1fd73b03-011f-d73b071a-0000000f", "ff808181-1fd7389e-011f-d7389f84-00000020", "ff808181-1fd7389e-011f-d7389fa9-0000002a", "ff808181-1fd7389e-011f-d7389f20-0000000d", "ff808181-1fd7389e-011f-d7389f4f-00000019", "ff808181-1fd7389e-011f-d7389fad-0000002b", "ff808181-1fd7389e-011f-d7389f2c-00000010", "ff808181-1fd7389e-011f-d7389f3b-00000014", "ff808181-1fd7389e-011f-d7389f4b-00000018", "ff808181-1fd7389e-011f-d7389ecc-00000001", "ff808181-1fd7389e-011f-d7389f30-00000011", "ff808181-1fd7389e-011f-d7389f47-00000017", "00f1fcb8-20a0fb67-0120-a144373f-000001ed" ],
                  "execution" : "or"
                }
              } ]
            }
          }, {
            "term" : {
              "category_path" : "/public/categories/sys/Ongoing"
            }
          } ]
        }
      }, {
        "range" : {
          "end_utc" : {
            "from" : "20131022T040000Z",
            "to" : null,
            "include_lower" : true,
            "include_upper" : true
          }
        }
      }, {
        "range" : {
          "start_utc" : {
            "from" : null,
            "to" : "20131122T050000Z",
            "include_lower" : true,
            "include_upper" : false
          }
        }
      } ]
    }
  }
}'

curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "from" : 0,
  "filter" : {
    "and" : {
      "filters" : [ {
        "and" : {
          "filters" : [ {
            "and" : {
              "filters" : [ {
                "term" : {
                  "path" : "/public/cals/MainCal"
                }
              }, {
                "terms" : {
                  "category_uid" : [ "ff808181-1fd7389e-011f-d7389f9a-00000026", "ff808181-1fd7389e-011f-d7389ed0-00000002", "ff808181-1fd7389e-011f-d7389ef9-00000003", "ff808181-1fd7389e-011f-d7389eff-00000004", "ff808181-1fd7389e-011f-d7389f02-00000005", "ff808181-1fd7389e-011f-d7389f15-0000000a", "ff808181-1fd73b03-011f-d73b065c-00000002", "ff808181-1fd7389e-011f-d7389f24-0000000e", "402881e6-20a21413-0120-a23d71e5-00000015", "ff808181-1fd7389e-011f-d7389f33-00000012", "ff808181-1fd7389e-011f-d7389f8b-00000022", "ff808181-1fd7389e-011f-d7389f38-00000013", "ff808181-1fd7389e-011f-d7389f3f-00000015", "402881e6-20a21413-0120-a24c742e-00000058", "402881e6-20a21413-0120-a248f865-00000020", "402881e6-20a21413-0120-a24bfbc2-00000057", "402881e6-20a21413-0120-a24bc8db-00000056", "ff808181-1fd7389e-011f-d7389f0a-00000007", "ff808181-1fd7389e-011f-d7389f1c-0000000c", "ff808181-1fd73b03-011f-d73b06f8-0000000c", "ff808181-1fd7389e-011f-d7389f8f-00000023", "ff808181-1fd7389e-011f-d7389ec8-00000000", "ff808181-1fd7389e-011f-d7389f06-00000006", "ff808181-1fd7389e-011f-d7389f0d-00000008", "ff808181-1fd7389e-011f-d7389f59-0000001c", "ff808181-1fd7389e-011f-d7389f18-0000000b", "402881e6-20a21413-0120-a236d0b1-00000014", "ff808181-1fd7389e-011f-d7389f28-0000000f", "ff808181-1fd7389e-011f-d7389f88-00000021", "ff808181-1fd7389e-011f-d7389fa2-00000028", "ff808181-1fd7389e-011f-d7389fa5-00000029", "ff808181-1fd7389e-011f-d7389f96-00000025", "402881e6-20a21413-0120-a22de2dd-0000000d", "402881e6-20a21413-0120-a22fdf78-00000010", "ff808181-1fd73b03-011f-d73b0714-0000000e", "ff808181-1fd7389e-011f-d7389f80-0000001f", "ff808181-1fd7389e-011f-d7389f60-0000001e", "ff808181-1fd73b03-011f-d73b071a-0000000f", "ff808181-1fd7389e-011f-d7389f84-00000020", "ff808181-1fd7389e-011f-d7389fa9-0000002a", "ff808181-1fd7389e-011f-d7389f20-0000000d", "ff808181-1fd7389e-011f-d7389f4f-00000019", "ff808181-1fd7389e-011f-d7389fad-0000002b", "ff808181-1fd7389e-011f-d7389f2c-00000010", "ff808181-1fd7389e-011f-d7389f3b-00000014", "ff808181-1fd7389e-011f-d7389f4b-00000018", "ff808181-1fd7389e-011f-d7389ecc-00000001", "ff808181-1fd7389e-011f-d7389f30-00000011", "ff808181-1fd7389e-011f-d7389f47-00000017", "00f1fcb8-20a0fb67-0120-a144373f-000001ed" ],
                  "execution" : "or"
                }
              } ]
            }
          }, {
            "term" : {
              "category_path" : "/public/categories/sys/Ongoing"
            }
          } ]
        }
      } ]
    }
  }
}'

curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "from" : 0,
  "filter" : {
    "and" : {
          "filters" : [ {
            "and" : {
              "filters" : [ {
                "term" : {
                  "path" : "/public/cals/MainCal"
                }
              }, {
                "terms" : {
                  "category_uid" : [ "ff808181-1fd7389e-011f-d7389f9a-00000026", "ff808181-1fd7389e-011f-d7389ed0-00000002", "ff808181-1fd7389e-011f-d7389ef9-00000003", "ff808181-1fd7389e-011f-d7389eff-00000004", "ff808181-1fd7389e-011f-d7389f02-00000005", "ff808181-1fd7389e-011f-d7389f15-0000000a", "ff808181-1fd73b03-011f-d73b065c-00000002", "ff808181-1fd7389e-011f-d7389f24-0000000e", "402881e6-20a21413-0120-a23d71e5-00000015", "ff808181-1fd7389e-011f-d7389f33-00000012", "ff808181-1fd7389e-011f-d7389f8b-00000022", "ff808181-1fd7389e-011f-d7389f38-00000013", "ff808181-1fd7389e-011f-d7389f3f-00000015", "402881e6-20a21413-0120-a24c742e-00000058", "402881e6-20a21413-0120-a248f865-00000020", "402881e6-20a21413-0120-a24bfbc2-00000057", "402881e6-20a21413-0120-a24bc8db-00000056", "ff808181-1fd7389e-011f-d7389f0a-00000007", "ff808181-1fd7389e-011f-d7389f1c-0000000c", "ff808181-1fd73b03-011f-d73b06f8-0000000c", "ff808181-1fd7389e-011f-d7389f8f-00000023", "ff808181-1fd7389e-011f-d7389ec8-00000000", "ff808181-1fd7389e-011f-d7389f06-00000006", "ff808181-1fd7389e-011f-d7389f0d-00000008", "ff808181-1fd7389e-011f-d7389f59-0000001c", "ff808181-1fd7389e-011f-d7389f18-0000000b", "402881e6-20a21413-0120-a236d0b1-00000014", "ff808181-1fd7389e-011f-d7389f28-0000000f", "ff808181-1fd7389e-011f-d7389f88-00000021", "ff808181-1fd7389e-011f-d7389fa2-00000028", "ff808181-1fd7389e-011f-d7389fa5-00000029", "ff808181-1fd7389e-011f-d7389f96-00000025", "402881e6-20a21413-0120-a22de2dd-0000000d", "402881e6-20a21413-0120-a22fdf78-00000010", "ff808181-1fd73b03-011f-d73b0714-0000000e", "ff808181-1fd7389e-011f-d7389f80-0000001f", "ff808181-1fd7389e-011f-d7389f60-0000001e", "ff808181-1fd73b03-011f-d73b071a-0000000f", "ff808181-1fd7389e-011f-d7389f84-00000020", "ff808181-1fd7389e-011f-d7389fa9-0000002a", "ff808181-1fd7389e-011f-d7389f20-0000000d", "ff808181-1fd7389e-011f-d7389f4f-00000019", "ff808181-1fd7389e-011f-d7389fad-0000002b", "ff808181-1fd7389e-011f-d7389f2c-00000010", "ff808181-1fd7389e-011f-d7389f3b-00000014", "ff808181-1fd7389e-011f-d7389f4b-00000018", "ff808181-1fd7389e-011f-d7389ecc-00000001", "ff808181-1fd7389e-011f-d7389f30-00000011", "ff808181-1fd7389e-011f-d7389f47-00000017", "00f1fcb8-20a0fb67-0120-a144373f-000001ed" ],
                  "execution" : "or"
                }
              } ]
            }
          }, {
            "term" : {
              "category_path" : "/public/categories/sys/Ongoing"
            }
          } ]
    }
  }
}'

curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "from" : 0,
  "query": {
    "match_all": {}
  },
  "filter" : {
            "term" : {
              "category_path" : "/public/categories/sys/Ongoing"
            }
  }
}'

curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "from" : 0,
  "query": {
    "match_all": {}
  }
}'


curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 0,
  "filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "creator" : "/principals/users/agrp_calsuite-MainCampus"
        }
      }, {
        "range" : {
          "dtend_utc" : {
            "from" : "20131105T000000Z",
            "to" : null,
            "include_lower" : true,
            "include_upper" : true
          }
        }
      }, {
        "range" : {
          "dtstart_utc" : {
            "from" : null,
            "to" : "20131206T000000Z",
            "include_lower" : true,
            "include_upper" : false
          }
        }
      } ]
    }
  },
  "sort" : [ {
    "dtstart_utc" : {
      "order" : "asc"
    }
  } ]
}'


curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 30,
  "filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "creator" : "/principals/users/agrp_calsuite-MainCampus"
        }
      } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'

curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 30,
  "fields": ["href","public"],
  "filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "_type" : "location"
        }
      } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'

curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 10,
  "version" : true,
  "filter" : {
    "and" : {
      "filters" : [ {
        "range" : {
          "dtend_utc" : {
            "from" : "20131106T000000Z",
            "to" : null,
            "include_lower" : true,
            "include_upper" : true
          }
        }
      }, {
        "range" : {
          "dtstart_utc" : {
            "from" : null,
            "to" : "20131207T000000Z",
            "include_lower" : true,
            "include_upper" : false
          }
        }
      } ]
    }
  }
}'

curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 0,
  "filter" : {
    "range" : {
      "dtend.utc" : {
        "from" : "20131204T000000Z",
        "to" : null,
        "include_lower" : true,
        "include_upper" : true
      }
    }
  }
}'

curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "from" : 0,
  "query" :{
      "match" : {
          "summary.value" : {
              "query" : "topical"
          }
      }
  }
}'

curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 0,
  "filter" : {
    "and" : {
      "filters" : [ {
        "and" : {
          "filters" : [ {
            "term" : {
              "categories.uid" : "ff808181-1fd7389e-011f-d7389f4b-00000018"
            }
          }, {
            "term" : {
              "colpath" : "/public/cals/MainCal"
            }
          }, {
            "terms" : {
              "_type" : [ "event", "todo" ],
              "execution" : "or"
            }
          } ]
        }
      }, {
        "range" : {
          "dtend.utc" : {
            "from" : "20131209T000000Z",
            "to" : null,
            "include_lower" : true,
            "include_upper" : true
          }
        }
      } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'

curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 0,
  "filter" : {
          "term" : {
            "categories/uid" : "ff808181-1fd7389e-011f-d7389f4b-00000018"
          }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'

curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 10,
  "filter" : {
          "term" : {
            "categories.uid" : "ff808181-1fd7389e-011f-d7389f4b-00000018"
          }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'

----------------------------------------------------
Ongoing search

curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 0,
  "filter" : {
    "and" : {
      "filters" : [ {
        "and" : {
          "filters" : [ {
            "term" : {
              "categories.uid" : "402881e7-25b99d14-0125-b9a50c22-00000002"
            }
          }, {
            "term" : {
              "colpath" : "/public/cals/MainCal"
            }
          }, {
            "terms" : {
              "_type" : [ "event", "todo" ],
              "execution" : "or"
            }
          } ]
        }
      }, {
        "range" : {
          "dtend.utc" : {
            "from" : "20131210T000000Z",
            "to" : null,
            "include_lower" : true,
            "include_upper" : true
          }
        }
      } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}

curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 1000,
  "filter" : {
    "and" : {
      "filters" : [ {
        "not" : {
          "filter" : {
            "term" : {
              "categories.uid" : "00f1fcdb-0f068baf-010f-068baf94-00000007"
            }
          }
        }
      }, {
        "range" : {
          "dtend.utc" : {
            "from" : "20131210T000000Z",
            "to" : null,
            "include_lower" : true,
            "include_upper" : true
          }
        }
      }, {
        "range" : {
          "dtend.utc" : {
            "from" : null,
            "to" : "20131217T000000Z",
            "include_lower" : true,
            "include_upper" : false
          }
        }
      } ]
    }
  },
  "fields" : ["topicalarea", "categories"]

}'


curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 10,
  "filter" : {
            "term" : {
              "categories.uid" : "ff808181-1fd7389e-011f-d7389f4b-00000018"
            }
  },
  "fields" : ["topicalarea", "categories", "href"]

}'

curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 100,
  "filter" : {
        "not" : {
          "filter" : {
            "term" : {
              "categories.href" : "/public/.bedework/categories/Academic Calendar"
            }
          }
        }
  },
  "fields" : ["topicalarea", "categories", "href"]

}'


curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 100,
  "filter" : {
            "term" : {
              "categories.href" : "/public/.bedework/categories/Academic Calendar"
            }
  },
  "fields" : ["topicalarea", "categories", "href"]

}'

---------------------------------------------------------
ADmin client request

curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 10,
  "filter" : {
    "and" : {
      "filters" : [ {
        "and" : {
          "filters" : [ {
            "term" : {
              "creatorHref" : "/principals/users/agrp_calsuite-MainCampus"
            }
          }, {
            "terms" : {
              "_type" : [ "event", "todo" ],
              "execution" : "or"
            }
          } ]
        }
      }, {
        "range" : {
          "dtend.utc" : {
            "from" : "20131217T000000Z",
            "to" : null,
            "include_lower" : true,
            "include_upper" : true
          }
        }
      } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'

curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 10,
  "filter" : {
    "and" : {
      "filters" : [ {
        "and" : {
          "filters" : [ {
            "terms" : {
              "_type" : [ "event", "todo" ],
              "execution" : "or"
            }
          } ]
        }
      } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'


curl -X GET 'localhost:9200/bwuser/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 10,
  "filter" : {
    "term" : {
      "event.colPath" : "/user/user02/Inbox"
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'

curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 1000,
  "filter" : {
      "term" : {
        "_type" : "event"
      }
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'


curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 1000,
  "fields" : ["href"],
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'


curl -X GET 'localhost:9200/bwuser/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 1000,
  "filter" : {
    "term" : {
      "colPath" : "/user/user01/calendar"
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'

curl -X GET 'localhost:9200/bwuser/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 10,
  "filter" : {
    "and" : {
      "filters" : [ {
        "range" : {
          "dtend.utc" : {
            "from" : "20140113T000000Z",
            "to" : null,
            "include_lower" : true,
            "include_upper" : true
          }
        }
      }, {
        "term" : {
          "public" : "true"
        }
      }, {
        "or" : {
          "filters" : [ {
            "not" : {
              "filter" : {
                "term" : {
                  "_type" : "event"
                }
              }
            }
          }, {
            "term" : {
              "instance" : "true"
            }
          }, {
            "and" : {
              "filters" : [ {
                "term" : {
                  "master" : "true"
                }
              }, {
                "term" : {
                  "recurring" : "false"
                }
              } ]
            }
          } ]
        }
      } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'


curl -X GET 'localhost:9200/bwuser/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 0,
  "filter" : {
    "and" : {
      "filters" : [ {
        "range" : {
          "dtend.utc" : {
            "from" : "20140113T000000Z",
            "to" : null,
            "include_lower" : true,
            "include_upper" : true
          }
        }
      }, {
        "term" : {
          "public" : "true"
        }
      }, {
        "or" : {
          "filters" : [ {
            "not" : {
              "filter" : {
                "term" : {
                  "_type" : "event"
                }
              }
            }
          }, {
            "term" : {
              "instance" : "true"
            }
          }, {
            "and" : {
              "filters" : [ {
                "term" : {
                  "master" : "true"
                }
              }, {
                "term" : {
                  "recurring" : "false"
                }
              } ]
            }
          } ]
        }
      } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'


curl -X GET 'localhost:9200/bwuser/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 100,
  "fields" : ["href", "uid"],
  "filter" : {
    "and" : {
      "filters" : [ {
        "range" : {
          "dtend.utc" : {
            "from" : "20140117T000000Z",
            "to" : null,
            "include_lower" : true,
            "include_upper" : true
          }
        }
      }, {
        "term" : {
          "public" : "false"
        }
      }, {
        "term" : {
          "ownerHref" : "/principals/users/resource03"
        }
      }, {
        "or" : {
          "filters" : [ {
            "not" : {
              "filter" : {
                "term" : {
                  "_type" : "event"
                }
              }
            }
          }, {
            "term" : {
              "instance" : "true"
            }
          }, {
            "and" : {
              "filters" : [ {
                "term" : {
                  "master" : "true"
                }
              }, {
                "term" : {
                  "recurring" : "false"
                }
              } ]
            }
          } ]
        }
      } ]
    }
  }
}
'


curl -X GET 'localhost:9200/bwuser/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 0,
  "filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "colPath" : "/user/user01/calendar"
        }
      }, {
        "or" : {
          "filters" : [ {
            "not" : {
              "filter" : {
                "term" : {
                  "_type" : "event"
                }
              }
            }
          }, {
            "term" : {
              "master" : "true"
            }
          }, {
            "term" : {
              "override" : "true"
            }
          } ]
        }
      } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'

curl -X GET 'localhost:9200/bwuser/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 0,
  "filter" : {
        "term" : {
          "colPath" : "/user/resource03/calendar"
        }
      },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'

curl -X GET 'localhost:9200/bwuser/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 1000,
  "filter" : {
      "term" : {
        "colPath" : "/user/user02/Inbox/"
      }
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'



curl -X GET 'localhost:9200/bwuser/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 1000,
  "fields": ["href","uid","summary","colPath","recurrenceId","recurrenceIds","dtstart","master","override"],
  "filter" : {
      "term" : {
        "ownerHref" : "/principals/users/douglm"
      }
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'

curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 1000,
  "fields": ["href","recurrenceId","recurrenceIds","master","override"],
  "filter" : {
      "term" : {
        "_type" : "event"
      }
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'

curl -XGET 'http://localhost:9200/bwpublic/_search' -d '{
    "query": {
        "filtered" : {
            "filter" : {
                "term" : { "_type" : "event" }
            }
        }
    }
}
'


curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 1000,
  "filter" : {
      "term" : {
        "uid" : "CAL-ff808081-592bff09-0159-2cf14fa4-000067c2demobedework@mysite.edu"
      }
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'

curl -X GET 'localhost:9200/bwuser/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 10,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "colPath" : "/public/unbrowsable/submissions/submissions"
        }
      }, {
        "range" : {
          "dtstart.utc" : {
            "from" : null,
            "to" : "20140430T040000Z",
            "include_lower" : true,
            "include_upper" : false
          }
        }
      }, {
        "range" : {
          "dtend.utc" : {
            "from" : "20140429T040000Z",
            "to" : null,
            "include_lower" : true,
            "include_upper" : true
          }
        }
      }, {
        "or" : {
          "filters" : [ {
            "not" : {
              "filter" : {
                "term" : {
                  "_type" : "event"
                }
              }
            }
          }, {
            "term" : {
              "instance" : "true"
            }
          }, {
            "term" : {
              "override" : "true"
            }
          }, {
            "and" : {
              "filters" : [ {
                "term" : {
                  "master" : "true"
                }
              }, {
                "term" : {
                  "recurring" : "false"
                }
              } ]
            }
          } ]
        }
      } ]
    }
  }
}'

curl -X GET 'localhost:9200/bwuser/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 10,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "colPath" : "/public/unbrowsable/submissions/submissions"
        }
      }, {
        "or" : {
          "filters" : [ {
            "not" : {
              "filter" : {
                "term" : {
                  "_type" : "event"
                }
              }
            }
          }, {
            "term" : {
              "instance" : "true"
            }
          }, {
            "term" : {
              "override" : "true"
            }
          }, {
            "and" : {
              "filters" : [ {
                "term" : {
                  "master" : "true"
                }
              }, {
                "term" : {
                  "recurring" : "false"
                }
              } ]
            }
          } ]
        }
      } ]
    }
  }
}'


curl -X GET 'localhost:9200/bwuser/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 0,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "range" : {
          "entityType" : {
            "from" : "20140514T100000Z",
            "to" : "20140514T230000Z",
            "include_lower" : true,
            "include_upper" : false
          }
        }
      }, {
        "term" : {
          "_type" : "event"
        }
      }, {
        "term" : {
          "colPath" : "/user/douglm/calendar"
        }
      }, {
        "or" : {
          "filters" : [ {
            "not" : {
              "filter" : {
                "term" : {
                  "_type" : "event"
                }
              }
            }
          }, {
            "term" : {
              "instance" : "true"
            }
          }, {
            "term" : {
              "override" : "true"
            }
          }, {
            "and" : {
              "filters" : [ {
                "term" : {
                  "master" : "true"
                }
              }, {
                "term" : {
                  "recurring" : "false"
                }
              } ]
            }
          } ]
        }
      } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}
'

curl -X GET 'localhost:9200/bwuser/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 10,
  "fields": ["dtstart","dtend","uid","summary","colPath","recurrenceId","recurrenceIds","master","override"],
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "_type" : "event"
        }
      }, {
        "term" : {
          "colPath" : "/user/douglm/calendar"
        }
      }, {
        "or" : {
          "filters" : [ {
            "not" : {
              "filter" : {
                "term" : {
                  "_type" : "event"
                }
              }
            }
          }, {
            "term" : {
              "instance" : "true"
            }
          }, {
            "term" : {
              "override" : "true"
            }
          }, {
            "and" : {
              "filters" : [ {
                "term" : {
                  "master" : "true"
                }
              }, {
                "term" : {
                  "recurring" : "false"
                }
              } ]
            }
          } ]
        }
      } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}
'

curl -X GET 'localhost:9200/bwuser/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 10,
  "fields": ["href","summary","dtstart","dtend"],
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "or" : {
          "filters" : [ {
            "and" : {
              "filters" : [ {
                "term" : {
                  "categories.uid" : "ff808181-1fd7389e-011f-d7389f9a-00000026"
                }
              }, {
                "term" : {
                  "colPath" : "/public/cals/MainCal"
                }
              } ]
            }
          }, {
            "and" : {
              "filters" : [ {
                "terms" : {
                  "categories.uid" : [ "ff808181-1fd7389e-011f-d7389ed0-00000002", "ff808181-1fd7389e-011f-d7389ef9-00000003", "ff808181-1fd7389e-011f-d7389eff-00000004", "ff808181-1fd7389e-011f-d7389f02-00000005", "ff808181-1fd7389e-011f-d7389f15-0000000a", "ff808181-1fd73b03-011f-d73b065c-00000002" ],
                  "execution" : "or"
                }
              }, {
                "term" : {
                  "colPath" : "/public/cals/MainCal"
                }
              } ]
            }
          }, {
            "and" : {
              "filters" : [ {
                "term" : {
                  "categories.uid" : "ff808181-1fd7389e-011f-d7389f24-0000000e"
                }
              }, {
                "term" : {
                  "colPath" : "/public/cals/MainCal"
                }
              } ]
            }
          }, {
            "and" : {
              "filters" : [ {
                "term" : {
                  "categories.uid" : "402881e6-20a21413-0120-a23d71e5-00000015"
                }
              }, {
                "term" : {
                  "colPath" : "/public/cals/MainCal"
                }
              } ]
            }
          }, {
            "and" : {
              "filters" : [ {
                "terms" : {
                  "categories.uid" : [ "ff808181-1fd7389e-011f-d7389f33-00000012", "ff808181-1fd7389e-011f-d7389f8b-00000022", "ff808181-1fd7389e-011f-d7389f38-00000013", "ff808181-1fd7389e-011f-d7389f3f-00000015" ],
                  "execution" : "or"
                }
              }, {
                "term" : {
                  "colPath" : "/public/cals/MainCal"
                }
              } ]
            }
          }, {
            "and" : {
              "filters" : [ {
                "terms" : {
                  "categories.uid" : [ "402881e6-20a21413-0120-a24c742e-00000058", "402881e6-20a21413-0120-a248f865-00000020", "402881e6-20a21413-0120-a24bfbc2-00000057", "402881e6-20a21413-0120-a24bc8db-00000056" ],
                  "execution" : "or"
                }
              }, {
                "term" : {
                  "colPath" : "/public/cals/MainCal"
                }
              } ]
            }
          }, {
            "and" : {
              "filters" : [ {
                "terms" : {
                  "categories.uid" : [ "ff808181-1fd7389e-011f-d7389f0a-00000007", "ff808181-1fd7389e-011f-d7389f1c-0000000c" ],
                  "execution" : "or"
                }
              }, {
                "term" : {
                  "colPath" : "/public/cals/MainCal"
                }
              } ]
            }
          }, {
            "and" : {
              "filters" : [ {
                "terms" : {
                  "categories.uid" : [ "ff808181-1fd73b03-011f-d73b06f8-0000000c", "ff808181-1fd7389e-011f-d7389f8f-00000023", "ff808181-1fd7389e-011f-d7389ec8-00000000", "ff808181-1fd7389e-011f-d7389f06-00000006", "ff808181-1fd7389e-011f-d7389f0d-00000008", "ff808181-1fd7389e-011f-d7389f59-0000001c", "ff808181-1fd7389e-011f-d7389f18-0000000b", "402881e6-20a21413-0120-a236d0b1-00000014", "ff808181-1fd7389e-011f-d7389f28-0000000f", "ff808181-1fd7389e-011f-d7389f88-00000021" ],
                  "execution" : "or"
                }
              }, {
                "term" : {
                  "colPath" : "/public/cals/MainCal"
                }
              } ]
            }
          }, {
            "and" : {
              "filters" : [ {
                "terms" : {
                  "categories.uid" : [ "ff808181-1fd7389e-011f-d7389fa2-00000028", "ff808181-1fd7389e-011f-d7389fa5-00000029", "ff808181-1fd7389e-011f-d7389f96-00000025", "402881e6-20a21413-0120-a22de2dd-0000000d", "402881e6-20a21413-0120-a22fdf78-00000010" ],
                  "execution" : "or"
                }
              }, {
                "term" : {
                  "colPath" : "/public/cals/MainCal"
                }
              } ]
            }
          }, {
            "and" : {
              "filters" : [ {
                "terms" : {
                  "categories.uid" : [ "ff808181-1fd73b03-011f-d73b0714-0000000e", "ff808181-1fd7389e-011f-d7389f80-0000001f", "ff808181-1fd7389e-011f-d7389f60-0000001e", "ff808181-1fd73b03-011f-d73b071a-0000000f", "ff808181-1fd7389e-011f-d7389f84-00000020", "ff808181-1fd7389e-011f-d7389fa9-0000002a" ],
                  "execution" : "or"
                }
              }, {
                "term" : {
                  "colPath" : "/public/cals/MainCal"
                }
              } ]
            }
          }, {
            "and" : {
              "filters" : [ {
                "term" : {
                  "categories.uid" : "ff808181-1fd7389e-011f-d7389f20-0000000d"
                }
              }, {
                "term" : {
                  "colPath" : "/public/cals/MainCal"
                }
              } ]
            }
          }, {
            "and" : {
              "filters" : [ {
                "terms" : {
                  "categories.uid" : [ "ff808181-1fd7389e-011f-d7389f4f-00000019", "ff808181-1fd7389e-011f-d7389fad-0000002b", "ff808181-1fd7389e-011f-d7389f2c-00000010", "ff808181-1fd7389e-011f-d7389f3b-00000014" ],
                  "execution" : "or"
                }
              }, {
                "term" : {
                  "colPath" : "/public/cals/MainCal"
                }
              } ]
            }
          }, {
            "and" : {
              "filters" : [ {
                "terms" : {
                  "categories.uid" : [ "ff808181-1fd7389e-011f-d7389f4b-00000018", "ff808181-1fd7389e-011f-d7389ecc-00000001", "ff808181-1fd7389e-011f-d7389f30-00000011", "ff808181-1fd7389e-011f-d7389f47-00000017", "00f1fcb8-20a0fb67-0120-a144373f-000001ed" ],
                  "execution" : "or"
                }
              }, {
                "term" : {
                  "colPath" : "/public/cals/MainCal"
                }
              } ]
            }
          } ]
        }
      }, {
        "and" : {
          "filters" : [ {
            "not" : {
              "filter" : {
                "term" : {
                  "categories.href" : "/public/.bedework/categories/sys/Ongoing"
                }
              }
            }
          }, {
            "terms" : {
              "_type" : [ "event", "todo" ],
              "execution" : "or"
            }
          }, {
            "range" : {
              "dtend.utc" : {
                "from" : "20140701T040000Z",
                "to" : null,
                "include_lower" : true,
                "include_upper" : true
              }
            }
          } ]
        }
      }, {
        "or" : {
          "filters" : [ {
            "not" : {
              "filter" : {
                "term" : {
                  "_type" : "event"
                }
              }
            }
          }, {
            "term" : {
              "instance" : "true"
            }
          }, {
            "term" : {
              "override" : "true"
            }
          }, {
            "and" : {
              "filters" : [ {
                "term" : {
                  "master" : "true"
                }
              }, {
                "term" : {
                  "recurring" : "false"
                }
              } ]
            }
          } ]
        }
      } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'

curl -X GET 'localhost:9200/bwuser/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 0,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "colPath" : "/public/cals/MainCal"
        }
      }, {
        "term" : {
          "suggestedTo" : "P:/principals/groups/bwadmin/calsuite-Engineering"
        }
      }, {
        "terms" : {
          "_type" : [ "event", "todo" ],
          "execution" : "or"
        }
      }, {
        "range" : {
          "dtend.utc" : {
            "from" : "20150210T050000Z",
            "to" : null,
            "include_lower" : false,
            "include_upper" : true
          }
        }
      }, {
        "or" : {
          "filters" : [ {
            "not" : {
              "filter" : {
                "term" : {
                  "_type" : "event"
                }
              }
            }
          }, {
            "term" : {
              "instance" : "true"
            }
          }, {
            "term" : {
              "override" : "true"
            }
          }, {
            "and" : {
              "filters" : [ {
                "term" : {
                  "master" : "true"
                }
              }, {
                "term" : {
                  "recurring" : "false"
                }
              } ]
            }
          } ]
        }
      } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}
'






curl -X GET 'localhost:9200/bwpublic/_search?pretty=true' -d'
{
  "from" : 0,
  "size" : 25,
  "post_filter" : {
        "term" : {
          "status" : "CONFIRMED"
        }
      },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}
'





curl -XGET 'http://localhost:9200/bwpublic/_mapping?pretty=true'






curl -XGET 'http://localhost:9200/bwpublic/_search' -d '
{
  "from" : 0,
  "size" : 60,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "uid" : "ff808181-1fd7389e-011f-d7389f4b-00000018"
        }
      }, {
        "term" : {
          "ownerHref" : "/principals/users/johnsa"
        }
      } ]
    }
  },
  "explain" : true
}'

{
  "from" : 0,
  "size" : 0,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "or" : {
          "filters" : [ {
            "and" : {
              "filters" : [ {
                "term" : {
                  "categories.uid" : "ff808181-1fd7389e-011f-d7389f4b-00000018"
                }
              }, {
                "term" : {
                  "colPath" : "/public/cals/MainCal"
                }
              } ]
            }
          }, {
            "term" : {
              "colPath" : "/user/johnsa/calendar"
            }
          } ]
        }
      }, {
        "and" : {
          "filters" : [ {
            "range" : {
              "dtstart.utc" : {
                "from" : null,
                "to" : "20140803T040000Z",
                "include_lower" : true,
                "include_upper" : false
              }
            }
          }, {
            "range" : {
              "dtend.utc" : {
                "from" : "20140727T040000Z",
                "to" : null,
                "include_lower" : false,
                "include_upper" : true
              }
            }
          } ]
        }
      }, {
        "or" : {
          "filters" : [ {
            "not" : {
              "filter" : {
                "term" : {
                  "_type" : "event"
                }
              }
            }
          }, {
            "term" : {
              "instance" : "true"
            }
          }, {
            "term" : {
              "override" : "true"
            }
          }, {
            "and" : {
              "filters" : [ {
                "term" : {
                  "master" : "true"
                }
              }, {
                "term" : {
                  "recurring" : "false"
                }
              } ]
            }
          } ]
        }
      } ]
    }
  }
}







  "hits" : {
    "total" : 39,
    "max_score" : 1.0,
    "hits" : [ {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "011 masterEvent069 /public/cals/MainCal/CAL-ff808081-47cda1d4-0147-db436ef1-000000ce.icsN",
      "_score" : 1.0,
      "fields" : {
        "master" : "true",
        "href" : "/public/cals/MainCal/CAL-ff808081-47cda1d4-0147-db436ef1-000000ce.ics"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "05 event069 /public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics016 20140823T040000Z",
      "_score" : 1.0,
      "fields" : {
        "href" : "/public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics",
        "recurrenceId" : "20140823T040000Z"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "05 event069 /public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics016 20140824T040000Z",
      "_score" : 1.0,
      "fields" : {
        "href" : "/public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics",
        "recurrenceId" : "20140824T040000Z"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "011 masterEvent069 /public/cals/MainCal/CAL-ff808081-48238674-0148-375beab2-0000002c.icsN",
      "_score" : 1.0,
      "fields" : {
        "master" : "true",
        "href" : "/public/cals/MainCal/CAL-ff808081-48238674-0148-375beab2-0000002c.ics"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "011 masterEvent069 /public/cals/MainCal/CAL-ff808081-4837f6e6-0148-37f7466f-00000001.icsN",
      "_score" : 1.0,
      "fields" : {
        "master" : "true",
        "href" : "/public/cals/MainCal/CAL-ff808081-4837f6e6-0148-37f7466f-00000001.ics"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "011 masterEvent069 /public/cals/MainCal/CAL-ff808081-47c638b9-0147-c6708790-00000008.icsN",
      "_score" : 1.0,
      "fields" : {
        "master" : "true",
        "href" : "/public/cals/MainCal/CAL-ff808081-47c638b9-0147-c6708790-00000008.ics"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "013 overrideEvent069 /public/cals/MainCal/CAL-ff808081-47cda1d4-0147-db436ef1-000000ce.ics016 20140817T200000Z",
      "_score" : 1.0,
      "fields" : {
        "href" : "/public/cals/MainCal/CAL-ff808081-47cda1d4-0147-db436ef1-000000ce.ics",
        "override" : "true",
        "recurrenceId" : "20140817T200000Z"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "013 overrideEvent069 /public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics016 20140819T040000Z",
      "_score" : 1.0,
      "fields" : {
        "href" : "/public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics",
        "override" : "true",
        "recurrenceId" : "20140819T040000Z"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "05 event069 /public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics016 20140820T040000Z",
      "_score" : 1.0,
      "fields" : {
        "href" : "/public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics",
        "recurrenceId" : "20140820T040000Z"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "05 event069 /public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics016 20140827T040000Z",
      "_score" : 1.0,
      "fields" : {
        "href" : "/public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics",
        "recurrenceId" : "20140827T040000Z"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "05 event069 /public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics016 20140831T040000Z",
      "_score" : 1.0,
      "fields" : {
        "href" : "/public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics",
        "recurrenceId" : "20140831T040000Z"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "011 masterEvent069 /public/cals/MainCal/CAL-ff808081-46c43f9c-0146-c4405b6b-00000001.icsN",
      "_score" : 1.0,
      "fields" : {
        "master" : "true",
        "href" : "/public/cals/MainCal/CAL-ff808081-46c43f9c-0146-c4405b6b-00000001.ics"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "011 masterEvent069 /public/cals/MainCal/CAL-ff808081-4787f7af-0147-8cc65099-00000032.icsN",
      "_score" : 1.0,
      "fields" : {
        "master" : "true",
        "href" : "/public/cals/MainCal/CAL-ff808081-4787f7af-0147-8cc65099-00000032.ics"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "013 overrideEvent069 /public/cals/MainCal/CAL-ff808081-47cda1d4-0147-db436ef1-000000ce.ics016 20140819T200000Z",
      "_score" : 1.0,
      "fields" : {
        "href" : "/public/cals/MainCal/CAL-ff808081-47cda1d4-0147-db436ef1-000000ce.ics",
        "override" : "true",
        "recurrenceId" : "20140819T200000Z"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "013 overrideEvent069 /public/cals/MainCal/CAL-ff808081-47cda1d4-0147-db436ef1-000000ce.ics016 20140820T200000Z",
      "_score" : 1.0,
      "fields" : {
        "href" : "/public/cals/MainCal/CAL-ff808081-47cda1d4-0147-db436ef1-000000ce.ics",
        "override" : "true",
        "recurrenceId" : "20140820T200000Z"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "05 event069 /public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics016 20140822T040000Z",
      "_score" : 1.0,
      "fields" : {
        "href" : "/public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics",
        "recurrenceId" : "20140822T040000Z"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "05 event069 /public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics016 20140825T040000Z",
      "_score" : 1.0,
      "fields" : {
        "href" : "/public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics",
        "recurrenceId" : "20140825T040000Z"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "011 masterEvent069 /public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.icsN",
      "_score" : 1.0,
      "fields" : {
        "master" : "true",
        "href" : "/public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "011 masterEvent069 /public/cals/MainCal/CAL-ff808081-46c43f9c-0146-c440e9e8-00000002.icsN",
      "_score" : 1.0,
      "fields" : {
        "master" : "true",
        "href" : "/public/cals/MainCal/CAL-ff808081-46c43f9c-0146-c440e9e8-00000002.ics"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "05 event069 /public/cals/MainCal/CAL-ff808081-47cda1d4-0147-db436ef1-000000ce.ics016 20140815T200000Z",
      "_score" : 1.0,
      "fields" : {
        "href" : "/public/cals/MainCal/CAL-ff808081-47cda1d4-0147-db436ef1-000000ce.ics",
        "recurrenceId" : "20140815T200000Z"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "05 event069 /public/cals/MainCal/CAL-ff808081-47cda1d4-0147-db436ef1-000000ce.ics016 20140816T200000Z",
      "_score" : 1.0,
      "fields" : {
        "href" : "/public/cals/MainCal/CAL-ff808081-47cda1d4-0147-db436ef1-000000ce.ics",
        "recurrenceId" : "20140816T200000Z"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "05 event069 /public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics016 20140821T040000Z",
      "_score" : 1.0,
      "fields" : {
        "href" : "/public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics",
        "recurrenceId" : "20140821T040000Z"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "05 event069 /public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics016 20140828T040000Z",
      "_score" : 1.0,
      "fields" : {
        "href" : "/public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics",
        "recurrenceId" : "20140828T040000Z"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "05 event069 /public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics016 20140829T040000Z",
      "_score" : 1.0,
      "fields" : {
        "href" : "/public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics",
        "recurrenceId" : "20140829T040000Z"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "05 event069 /public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics016 20140830T040000Z",
      "_score" : 1.0,
      "fields" : {
        "href" : "/public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics",
        "recurrenceId" : "20140830T040000Z"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "011 masterEvent069 /public/cals/MainCal/CAL-ff808081-4860663b-0148-6520889c-0000002c.icsN",
      "_score" : 1.0,
      "fields" : {
        "master" : "true",
        "href" : "/public/cals/MainCal/CAL-ff808081-4860663b-0148-6520889c-0000002c.ics"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "011 masterEvent069 /public/cals/MainCal/CAL-ff808081-491e744d-0149-265b6de0-0000005f.icsN",
      "_score" : 1.0,
      "fields" : {
        "master" : "true",
        "href" : "/public/cals/MainCal/CAL-ff808081-491e744d-0149-265b6de0-0000005f.ics"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "011 masterEvent069 /public/cals/MainCal/CAL-ff808081-47427baa-0147-427cb478-00000085.icsN",
      "_score" : 1.0,
      "fields" : {
        "master" : "true",
        "href" : "/public/cals/MainCal/CAL-ff808081-47427baa-0147-427cb478-00000085.ics"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "011 masterEvent069 /public/cals/MainCal/CAL-ff808081-47427baa-0147-427d14f1-00000086.icsN",
      "_score" : 1.0,
      "fields" : {
        "master" : "true",
        "href" : "/public/cals/MainCal/CAL-ff808081-47427baa-0147-427d14f1-00000086.ics"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "013 overrideEvent069 /public/cals/MainCal/CAL-ff808081-47cda1d4-0147-db436ef1-000000ce.ics016 20140818T200000Z",
      "_score" : 1.0,
      "fields" : {
        "href" : "/public/cals/MainCal/CAL-ff808081-47cda1d4-0147-db436ef1-000000ce.ics",
        "override" : "true",
        "recurrenceId" : "20140818T200000Z"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "013 overrideEvent069 /public/cals/MainCal/CAL-ff808081-47cda1d4-0147-db436ef1-000000ce.ics016 20140821T200000Z",
      "_score" : 1.0,
      "fields" : {
        "href" : "/public/cals/MainCal/CAL-ff808081-47cda1d4-0147-db436ef1-000000ce.ics",
        "override" : "true",
        "recurrenceId" : "20140821T200000Z"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "013 overrideEvent069 /public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics016 20140818T040000Z",
      "_score" : 1.0,
      "fields" : {
        "href" : "/public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics",
        "override" : "true",
        "recurrenceId" : "20140818T040000Z"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "05 event069 /public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics016 20140826T040000Z",
      "_score" : 1.0,
      "fields" : {
        "href" : "/public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics",
        "recurrenceId" : "20140826T040000Z"
      }
    }, {
      "_index" : "bwpublicp20141022t001821",
      "_type" : "event",
      "_id" : "011 masterEvent069 /public/cals/MainCal/CAL-ff808081-492a27bb-0149-2e56157e-00000262.icsN",
      "_score" : 1.0,
      "fields" : {
        "master" : "true",
        "href" : "/public/cals/MainCal/CAL-ff808081-492a27bb-0149-2e56157e-00000262.ics"
      }
    } ]
  }
}

          "href" : "/public/cals/MainCal/CAL-ff808081-46c43f9c-0146-c4405b6b-00000001.ics"
          "href" : "/public/cals/MainCal/CAL-ff808081-46c43f9c-0146-c440e9e8-00000002.ics"
          "href" : "/public/cals/MainCal/CAL-ff808081-47427baa-0147-427cb478-00000085.ics"
          "href" : "/public/cals/MainCal/CAL-ff808081-47427baa-0147-427d14f1-00000086.ics"
          "href" : "/public/cals/MainCal/CAL-ff808081-4787f7af-0147-8cc65099-00000032.ics"
          "href" : "/public/cals/MainCal/CAL-ff808081-47c638b9-0147-c6708790-00000008.ics"
          "href" : "/public/cals/MainCal/CAL-ff808081-47cda1d4-0147-db436ef1-000000ce.ics"
          "href" : "/public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics"
          "href" : "/public/cals/MainCal/CAL-ff808081-48238674-0148-375beab2-0000002c.ics"
          "href" : "/public/cals/MainCal/CAL-ff808081-4837f6e6-0148-37f7466f-00000001.ics"
          "href" : "/public/cals/MainCal/CAL-ff808081-4860663b-0148-6520889c-0000002c.ics"
          "href" : "/public/cals/MainCal/CAL-ff808081-491e744d-0149-265b6de0-0000005f.ics"
          "href" : "/public/cals/MainCal/CAL-ff808081-492a27bb-0149-2e56157e-00000262.ics"

Not found


Succeeded
          "href" : "/public/cals/MainCal/CAL-ff808081-49390862-0149-4025290c-0000001c.ics"
          "href" : "/public/cals/MainCal/CAL-ff808081-49390862-0149-4025b708-0000001d.ics"
          "href" : "/public/cals/MainCal/CAL-ff808081-49390862-0149-40263ea7-0000001e.ics"
          "href" : "/public/cals/MainCal/CAL-ff808081-49390862-0149-40269ab1-0000001f.ics"
          "href" : "/public/cals/MainCal/not-a-uid-on-this-system.ics"

curl -XGET 'http://localhost:9200/bwpublic/_search' -d '
{
  "from" : 0,
  "size" : 60,

curl -XGET 'http://localhost:9200/bwpublic/_search?pretty=true' -d '
{
  "fields": ["href","recurrenceid","master"],
  "post_filter" : {
    "or" : {
      "filters" : [ {
        "term" : {
          "href" : "/public/cals/MainCal/CAL-ff808081-46c43f9c-0146-c4405b6b-00000001.ics"
        }
      }, {
        "term" : {
          "href" : "/public/cals/MainCal/CAL-ff808081-46c43f9c-0146-c440e9e8-00000002.ics"
        }
      }, {
        "term" : {
          "href" : "/public/cals/MainCal/CAL-ff808081-47427baa-0147-427cb478-00000085.ics"
        }
      }, {
        "term" : {
          "href" : "/public/cals/MainCal/CAL-ff808081-47427baa-0147-427d14f1-00000086.ics"
        }
      }, {
        "term" : {
          "href" : "/public/cals/MainCal/CAL-ff808081-4787f7af-0147-8cc65099-00000032.ics"
        }
      }, {
        "term" : {
          "href" : "/public/cals/MainCal/CAL-ff808081-47c638b9-0147-c6708790-00000008.ics"
        }
      }, {
        "term" : {
          "href" : "/public/cals/MainCal/CAL-ff808081-47cda1d4-0147-db436ef1-000000ce.ics"
        }
      }, {
        "term" : {
          "href" : "/public/cals/MainCal/CAL-ff808081-47ea7455-0147-ea760b56-00000022.ics"
        }
      }, {
        "term" : {
          "href" : "/public/cals/MainCal/CAL-ff808081-48238674-0148-375beab2-0000002c.ics"
        }
      }, {
        "term" : {
          "href" : "/public/cals/MainCal/CAL-ff808081-4837f6e6-0148-37f7466f-00000001.ics"
        }
      }, {
        "term" : {
          "href" : "/public/cals/MainCal/CAL-ff808081-4860663b-0148-6520889c-0000002c.ics"
        }
      }, {
        "term" : {
          "href" : "/public/cals/MainCal/CAL-ff808081-491e744d-0149-265b6de0-0000005f.ics"
        }
      }, {
        "term" : {
          "href" : "/public/cals/MainCal/CAL-ff808081-492a27bb-0149-2e56157e-00000262.ics"
        }
      }, {
        "term" : {
          "href" : "/public/cals/MainCal/CAL-ff808081-49390862-0149-4025290c-0000001c.ics"
        }
      }, {
        "term" : {
          "href" : "/public/cals/MainCal/CAL-ff808081-49390862-0149-4025b708-0000001d.ics"
        }
      }, {
        "term" : {
          "href" : "/public/cals/MainCal/CAL-ff808081-49390862-0149-40263ea7-0000001e.ics"
        }
      }, {
        "term" : {
          "href" : "/public/cals/MainCal/CAL-ff808081-49390862-0149-40269ab1-0000001f.ics"
        }
      }, {
        "term" : {
          "href" : "/public/cals/MainCal/not-a-uid-on-this-system.ics"
        }
      } ]
    }
  }
}'


srb={
  "from" : 0,
  "size" : 0,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "creatorHref" : "/principals/users/agrp_Communications"
        }
      }, {
        "term" : {
          "colPath" : "/public/unbrowsable/workflow/unapproved"
        }
      }, {
        "range" : {
          "dtend.utc" : {
            "from" : "20150414T040000Z",
            "to" : null,
            "include_lower" : false,
            "include_upper" : true
          }
        }
      }, {
        "or" : {
          "filters" : [ {
            "not" : {
              "filter" : {
                "term" : {
                  "_type" : "event"
                }
              }
            }
          }, {
            "term" : {
              "instance" : "true"
            }
          }, {
            "term" : {
              "override" : "true"
            }
          }, {
            "and" : {
              "filters" : [ {
                "term" : {
                  "master" : "true"
                }
              }, {
                "term" : {
                  "recurring" : "false"
                }
              } ]
            }
          } ]
        }
      } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}


  "fields": ["href","summary","creatorHref","recurrenceid","master","recurring"],

curl -XGET 'http://localhost:9200/bwpublic/_search?pretty=true' -d '
{
  "from" : 0,
  "size" : 100,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "uid" : "CAL-ff808181-4cb9b6c4-014c-b9baab6c-00000005demobedework@mysite.edu"
        }
      }, {
               "range" : {
                 "dtend.utc" : {
                   "from" : "20150414T040000Z",
                   "to" : null,
                   "include_lower" : false,
                   "include_upper" : true
                 }
               }
             }, {
               "or" : {
                 "filters" : [ {
                   "not" : {
                     "filter" : {
                       "term" : {
                         "_type" : "event"
                       }
                     }
                   }
                 }, {
                   "term" : {
                     "instance" : "true"
                   }
                 }, {
                   "term" : {
                     "override" : "true"
                   }
                 }, {
                   "and" : {
                     "filters" : [ {
                       "term" : {
                         "master" : "true"
                       }
                     }, {
                       "term" : {
                         "recurring" : "false"
                       }
                     } ]
                   }
                 } ]
               }
             }]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'



curl -XGET 'http://localhost:9200/profiles/_search?pretty=true' -d '
{
  "from" : 0,
  "size" : 5,
  "post_filter" : {
    "term" : {
      "_type" : "profile"
    }
  }
}'

curl localhost:9200/bwpublic/_termvector?pretty=true

curl -XGET 'http://localhost:9200/bwpublic/_search?pretty=true' -d '
{
  "from" : 0,
  "size" : 0,
  "query" : {
    "match" : {
      "_all" : {
        "query" : "my",
        "type" : "phrase"
      }
    }
  },
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "terms" : {
          "_type" : [ "event", "todo" ],
          "execution" : "or"
        }
      }, {
        "range" : {
          "dtend.utc" : {
            "from" : "20150522T040000Z",
            "to" : null,
            "include_lower" : false,
            "include_upper" : true
          }
        }
      }, {
        "or" : {
          "filters" : [ {
            "and" : {
              "filters" : [ {
                "terms" : {
                  "categories.uid" : [ "ff808181-1fd7389e-011f-d7389f4b-00000018", "ff808181-1fd7389e-011f-d7389ecc-00000001", "ff808181-1fd7389e-011f-d7389f30-00000011", "ff808181-1fd7389e-011f-d7389f47-00000017", "00f1fcb8-20a0fb67-0120-a144373f-000001ed" ],
                  "execution" : "or"
                }
              }, {
                "term" : {
                  "colPath" : "/public/cals/MainCal"
                }
              } ]
            }
          }, {
            "and" : {
              "filters" : [ {
                "term" : {
                  "categories.uid" : "ff808181-1fd7389e-011f-d7389f24-0000000e"
                }
              }, {
                "term" : {
                  "colPath" : "/public/cals/MainCal"
                }
              } ]
            }
          }, {
            "and" : {
              "filters" : [ {
                "term" : {
                  "categories.uid" : "ff808181-1fd7389e-011f-d7389f9a-00000026"
                }
              }, {
                "term" : {
                  "colPath" : "/public/cals/MainCal"
                }
              } ]
            }
          }, {
            "and" : {
              "filters" : [ {
                "term" : {
                  "categories.uid" : "402881e6-20a21413-0120-a23d71e5-00000015"
                }
              }, {
                "term" : {
                  "colPath" : "/public/cals/MainCal"
                }
              } ]
            }
          }, {
            "and" : {
              "filters" : [ {
                "terms" : {
                  "categories.uid" : [ "402881e6-20a21413-0120-a24c742e-00000058", "402881e6-20a21413-0120-a248f865-00000020", "402881e6-20a21413-0120-a24bfbc2-00000057", "402881e6-20a21413-0120-a24bc8db-00000056" ],
                  "execution" : "or"
                }
              }, {
                "term" : {
                  "colPath" : "/public/cals/MainCal"
                }
              } ]
            }
          }, {
            "and" : {
              "filters" : [ {
                "terms" : {
                  "categories.uid" : [ "ff808181-1fd7389e-011f-d7389f0a-00000007", "ff808181-1fd7389e-011f-d7389f1c-0000000c" ],
                  "execution" : "or"
                }
              }, {
                "term" : {
                  "colPath" : "/public/cals/MainCal"
                }
              } ]
            }
          }, {
            "and" : {
              "filters" : [ {
                "terms" : {
                  "categories.uid" : [ "ff808181-1fd73b03-011f-d73b06f8-0000000c", "ff808181-1fd7389e-011f-d7389f8f-00000023", "ff808181-1fd7389e-011f-d7389ec8-00000000", "ff808181-1fd7389e-011f-d7389f06-00000006", "ff808181-1fd7389e-011f-d7389f0d-00000008", "ff808181-1fd7389e-011f-d7389f59-0000001c", "ff808181-1fd7389e-011f-d7389f18-0000000b", "402881e6-20a21413-0120-a236d0b1-00000014", "ff808181-1fd7389e-011f-d7389f28-0000000f", "ff808181-1fd7389e-011f-d7389f88-00000021" ],
                  "execution" : "or"
                }
              }, {
                "term" : {
                  "colPath" : "/public/cals/MainCal"
                }
              } ]
            }
          }, {
            "and" : {
              "filters" : [ {
                "terms" : {
                  "categories.uid" : [ "ff808181-1fd7389e-011f-d7389fa2-00000028", "ff808181-1fd7389e-011f-d7389fa5-00000029", "ff808181-1fd7389e-011f-d7389f96-00000025", "402881e6-20a21413-0120-a22de2dd-0000000d", "402881e6-20a21413-0120-a22fdf78-00000010" ],
                  "execution" : "or"
                }
              }, {
                "term" : {
                  "colPath" : "/public/cals/MainCal"
                }
              } ]
            }
          }, {
            "and" : {
              "filters" : [ {
                "terms" : {
                  "categories.uid" : [ "ff808181-1fd73b03-011f-d73b0714-0000000e", "ff808181-1fd7389e-011f-d7389f80-0000001f", "ff808181-1fd7389e-011f-d7389f60-0000001e", "ff808181-1fd73b03-011f-d73b071a-0000000f", "ff808181-1fd7389e-011f-d7389f84-00000020", "ff808181-1fd7389e-011f-d7389fa9-0000002a" ],
                  "execution" : "or"
                }
              }, {
                "term" : {
                  "colPath" : "/public/cals/MainCal"
                }
              } ]
            }
          }, {
            "and" : {
              "filters" : [ {
                "term" : {
                  "categories.uid" : "ff808181-1fd7389e-011f-d7389f20-0000000d"
                }
              }, {
                "term" : {
                  "colPath" : "/public/cals/MainCal"
                }
              } ]
            }
          }, {
            "and" : {
              "filters" : [ {
                "terms" : {
                  "categories.uid" : [ "ff808181-1fd7389e-011f-d7389f4f-00000019", "ff808181-1fd7389e-011f-d7389fad-0000002b", "ff808181-1fd7389e-011f-d7389f2c-00000010", "ff808181-1fd7389e-011f-d7389f3b-00000014" ],
                  "execution" : "or"
                }
              }, {
                "term" : {
                  "colPath" : "/public/cals/MainCal"
                }
              } ]
            }
          }, {
            "or" : {
              "filters" : [ {
                "and" : {
                  "filters" : [ {
                    "terms" : {
                      "categories.uid" : [ "ff808181-1fd7389e-011f-d7389ed0-00000002", "ff808181-1fd7389e-011f-d7389ef9-00000003", "ff808181-1fd7389e-011f-d7389eff-00000004", "ff808181-1fd7389e-011f-d7389f02-00000005", "ff808181-1fd7389e-011f-d7389f15-0000000a", "ff808181-1fd73b03-011f-d73b065c-00000002" ],
                      "execution" : "or"
                    }
                  }, {
                    "term" : {
                      "colPath" : "/public/cals/MainCal"
                    }
                  } ]
                }
              }, {
                "term" : {
                  "colPath" : "/public/aliases/Arts/Performing Arts EMS"
                }
              } ]
            }
          } ]
        }
      }, {
        "or" : {
          "filters" : [ {
            "not" : {
              "filter" : {
                "term" : {
                  "_type" : "event"
                }
              }
            }
          }, {
            "term" : {
              "instance" : "true"
            }
          }, {
            "term" : {
              "override" : "true"
            }
          }, {
            "and" : {
              "filters" : [ {
                "term" : {
                  "master" : "true"
                }
              }, {
                "term" : {
                  "recurring" : "false"
                }
              } ]
            }
          } ]
        }
      } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'


curl -XGET 'http://localhost:9200/cities/_search?pretty=true' -d '
{
  "from" : 0,
  "size" : 1,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "name" : "Kigali"
        }
      }, {
        "term" : {
          "_type" : "city"
        }
      } ]
    }
  }
}'


curl -XGET 'http://localhost:9200/cities/_search?pretty=true' -d '
{
  "from" : 0,
  "size" : 10,
    "query" : {
        "match_all" : {}
    }
}'

curl -XGET 'http://localhost:9200/languages/_search?pretty=true' -d '
{
  "from" : 0,
  "size" : 10,
    "query" : {
        "match_all" : {}
    }
}'

curl -XGET 'http://localhost:9200/categories/_search?pretty=true' -d '
{
  "from" : 0,
  "size" : 10,
  "query" : {
    "bool" : {
      "should" : {
        "match" : {
          "catName.autocat" : {
            "query" : "Amat"
          }
        }
      }
    }
  },
  "post_filter" : {
    "prefix" : {
      "href" : "/category/socialInterests/"
    }
  }
}
'


curl -XGET 'http://localhost:9200/languages/_search?pretty=true&search_type=query_and_fetch' -d '
{
  "from" : 0,
  "size" : 10,
  "query" : {
    "bool" : {
      "should" : {
        "match" : {
          "name.autolang" : {
            "query" : "engl"
          }
        }
      }
    }
  }
}'

curl -XGET 'http://localhost:9200/countries/_search?pretty=true' -d '
{
  "from" : 0,
  "size" : 10,
    "query" : {
        "match_all" : {}
    }
}'

curl -XGET 'http://localhost:9200/categories/_search?pretty=true' -d '
{
  "from" : 0,
  "size" : 10,
    "query" : {
        "match_all" : {}
    }
}'

curl -XGET 'http://localhost:9200/cities/_search?pretty=true' -d '
{
  "from" : 0,
  "size" : 10,
    "query" : {
        "match_all" : {}
    }
}'

curl -XGET 'http://localhost:9200/profiles/_search?pretty=true' -d '{
    "query": {
        "filtered" : {
            "filter" : {
                "term" : { "_type" : "updates" }
            }
        }
    }
}
'


curl -XGET 'localhost:9200/cities/_search?search_type=scan&scroll=10m&size=50' -d '
{
    "query" : {
        "match_all" : {}
    }
}'


curl -XGET 'http://localhost:9200/profiles/_search?pretty=true' -d '
{
  "from" : 0,
  "size" : 5,
  "query" : {
    "bool" : {
      "should" : [ {
        "match" : {
          "fullname" : {
            "query" : "doug",
            "boost" : 30.0
          }
        }
      }, {
        "match" : {
          "_all" : {
            "query" : "doug"
          }
        }
      } ]
    }
  }
}'

curl -XGET 'http://localhost:9200/profiles/_search?pretty=true' -d '
{
  "from" : 0,
  "size" : 5,
    "query" : {
        "match_all" : {}
    },
          "fields" : [  "fullName", "href",
                        "entityType",
                        "uid",
                        "affiliations.department"]

}'


curl -XGET 'http://localhost:9200/profiles/_search?pretty=true' -d '
{
  "from" : 0,
  "size" : 5,
  "query" : {
        "match" : {
          "fullName" : {
            "query" : "doug",
            "boost" : 30.0
          }
    }
  },
     "fields" : [  "fullName", "href",
                   "entityType",
                   "uid",
                   "givenName",
                   "familyName"]

}'

curl -XGET 'http://localhost:9200/profiles/profile/principal/user/md3571/_explain?pretty=true' -d '
{
  "from" : 0,
  "size" : 5,
  "query" : {
        "match" : {
          "fullname" : {
            "query" : "doug",
            "boost" : 30.0
          }
    }
  },
     "fields" : [  "href",
                   "entityType",
                   "uid",
                   "givenName",
                   "familyName"]

}'

<?xml version="1.0" encoding="UTF-8" ?>

<CSS:notification xmlns:C="urn:ietf:params:xml:ns:caldav"
              xmlns:BSS="http://bedework.org/ns/"
              xmlns:BW="http://bedeworkcalserver.org/ns/"
              xmlns:CSS="http://calendarserver.org/ns/"
              xmlns:DAV="DAV:">
  <BSS:processors>
    <BSS:processor>
      <BSS:type>email</BSS:type>
    </BSS:processor>
  </BSS:processors>
  <CSS:dtstamp>20150819T173132Z</CSS:dtstamp>
  <CSS:invite-notification shared-type="calendar">
    <BW:name>402881f4-4f470345-014f-47040de1-00000004</BW:name>
    <CSS:uid>402881f4-4f470345-014f-47040de1-00000004</CSS:uid>
    <DAV:href>mailto:douglm@mysite.edu</DAV:href>
    <CSS:invite-noresponse/>
    <CSS:access>
      <CSS:read-write/>
    </CSS:access>
    <CSS:hosturl>
      <DAV:href>/notifyws/user/mtwain/share</DAV:href>
    </CSS:hosturl>
    <CSS:organizer>
      <DAV:href>mailto:mtwain@mysite.edu</DAV:href>
      <CSS:common-name></CSS:common-name>
    </CSS:organizer>
    <CSS:summary>share</CSS:summary>
    <C:supported-calendar-component-set>
      <C:comp name="VEVENT"/>
      <C:comp name="VTODO"/>
      <C:comp name="VAVAILABILITY"/>
    </C:supported-calendar-component-set>
  </CSS:invite-notification>
</CSS:notification>


curl -XPOST 'http://localhost:8080/notify/notification/' --header "Content-Type:application/json" -d '
{
  "system" : "localBedework",
  "token" : "abcd",
  "hrefs" : [ "/principals/users/douglm/" ]
}'

curl -XPOST 'http://localhost:8080/notify/notification/' --header "Content-Type:application/json" -d '
{
  "system" : "localBedework",
  "token" : "abcd",
  "hrefs" : [ "/principals/users/douglm/" ]
}'

curl -XGET 'http://localhost:9200/bwpublic/_search?pretty=true' -d '
{
  "from" : 0,
  "size" : 5,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "colPath" : "/public/cals/MainCal"
        }
      }, {
        "term" : {
          "suggestedTo" : "P:/principals/groups/bwadmin/calsuite-Engineering"
        }
      }, {
        "terms" : {
          "_type" : [ "event", "todo" ],
          "execution" : "or"
        }
      }, {
        "range" : {
          "dtstart.utc" : {
            "from" : null,
            "to" : "20151229T050000Z",
            "include_lower" : true,
            "include_upper" : false
          }
        }
      }, {
        "range" : {
          "dtend.utc" : {
            "from" : "20150924T040000Z",
            "to" : null,
            "include_lower" : false,
            "include_upper" : true
          }
        }
      }, {
        "or" : {
          "filters" : [ {
            "not" : {
              "filter" : {
                "term" : {
                  "_type" : "event"
                }
              }
            }
          }, {
            "term" : {
              "instance" : "true"
            }
          }, {
            "term" : {
              "override" : "true"
            }
          }, {
            "and" : {
              "filters" : [ {
                "term" : {
                  "master" : "true"
                }
              }, {
                "term" : {
                  "recurring" : "false"
                }
              } ]
            }
          } ]
        }
      } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'


curl -XGET 'http://localhost:9200/bwpublic/_search?pretty=true' -d '
{
  "from" : 0,
  "size" : 5,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "colPath" : "/public/cals/MainCal"
        }
      }, {
        "terms" : {
          "_type" : [ "event", "todo" ],
          "execution" : "or"
        }
      }, {
        "range" : {
          "dtstart.utc" : {
            "from" : null,
            "to" : "20151104T050000Z",
            "include_lower" : true,
            "include_upper" : false
          }
        }
      }, {
        "range" : {
          "dtend.utc" : {
            "from" : "20151102T040000Z",
            "to" : null,
            "include_lower" : false,
            "include_upper" : true
          }
        }
      }, {
        "or" : {
          "filters" : [ {
            "not" : {
              "filter" : {
                "term" : {
                  "_type" : "event"
                }
              }
            }
          }, {
            "term" : {
              "instance" : "true"
            }
          }, {
            "term" : {
              "override" : "true"
            }
          }, {
            "and" : {
              "filters" : [ {
                "term" : {
                  "master" : "true"
                }
              }, {
                "term" : {
                  "recurring" : "false"
                }
              } ]
            }
          } ]
        }
      } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'

curl -XGET 'http://128.59.92.56:9200/bwuser/_search?pretty=true' -d '{
  "from" : 0,
  "size" : 60,
    "query": {
        "filtered" : {
            "filter" : {
                "term" : { "_type" : "collection" }
            }
        }
    }
}
'



curl -XGET 'http://localhost:9200/bwuser/_search?pretty=true&search_type=query_and_fetch' -d '
{
  "from" : 0,
  "size" : 10,
  "query" : {
    "bool" : {
      "must" : [
        {
                "term" : { "_type" : "collection" }
                    },
                    {
                "term" : { "creatorHref" : "/principals/users/agrp_CalSuite-Lally" }
                    }
      ]
    }
  }
}'

curl -XGET 'http://localhost:9200/bwuser/_search?pretty=true' -d '
{
  "from" : 0,
  "size" : 10,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "exists" : {
          "field" : "description"
        }
      }, {
        "term" : {
          "entityType" : "event"
        }
      }, {
        "term" : {
          "colPath" : "/user/user01/calendar"
        }
      } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'

curl -XGET 'http://localhost:9200/bwuser/_search?pretty=true&search_type=query_then_fetch' -d '
{
  "from" : 0,
  "size" : 20,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "entityType" : "event"
        }
      }, {
        "term" : {
          "colPath" : "/user/user01/calendar"
        }
      }, {
               "or" : {
                 "filters" : [ {
                   "term" : {
                     "master" : "true"
                   }
                 }, {
                   "term" : {
                     "override" : "true"
                   }
                 } ]
               }} ]
    }
  },
  "fields" : ["href","entityType","master","override"],
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'

curl -XGET 'http://localhost:9200/bwuser/_search?pretty=true&search_type=query_then_fetch' -d '
{
  "from" : 0,
  "size" : 20,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "entityType" : "event"
        }
      }, {
        "term" : {
          "colPath" : "/user/user01/calendar"
        }
      } ]
    }
  },
  "fields" : ["href","entityType","master","override", "instance", 
              "dtstart.utc", "dtend.utc", "indexStart.utc", "indexEnd.utc"],
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'

curl -XGET 'http://localhost:9200/bwuser/_search?pretty=true&search_type=query_then_fetch' -d '
{
  "from" : 0,
  "size" : 20,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "and" : {
          "filters" : [ {
            "range" : {
              "alarm.nextTrigger" : {
                "from" : "20170101T224500Z",
                "to" : "20170102T000000Z",
                "include_lower" : true,
                "include_upper" : false
              }
            }
          } ]
        }
      }, {
        "term" : {
          "entityType" : "event"
        }
      }, {
        "term" : {
          "colPath" : "/user/user01/calendar"
        }
      } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'

curl -XGET 'http://localhost:9200/bwuser/_search?pretty=true&search_type=query_then_fetch' -d '
{
  "from" : 0,
  "size" : 100,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "name" : "1.ics"
        }
      } ]
    }
  },
          "facets": {
              "uid" : { "terms" : {"field" : "uid"} }
          },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}'


{
  "from" : 0,
  "size" : 0,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "or" : {
          "filters" : [ {
            "and" : {
              "filters" : [ {
                "range" : {
                  "created" : {
                    "from" : "20060101T000000Z",
                    "to" : "20060102T000000Z",
                    "include_lower" : true,
                    "include_upper" : false
                  }
                }
              }, {
                "term" : {
                  "entityType" : "event"
                }
              } ]
            }
          }, {
            "and" : {
              "filters" : [ {
                "range" : {
                  "dtstamp" : {
                    "from" : "20051222T000000Z",
                    "to" : "20051223T000000Z",
                    "include_lower" : true,
                    "include_upper" : false
                  }
                }
              }, {
                "term" : {
                  "entityType" : "freeAndBusy"
                }
              } ]
            }
          } ]
        }
      }, {
        "term" : {
          "colPath" : "/user/user01/calendar"
        }
      } ]
    }
  },
  "sort" : [ {
    "dtstart.utc" : {
      "order" : "asc"
    }
  } ]
}


{
  "from" : 0,
  "size" : 60,
  "post_filter" : {
    "and" : {
      "filters" : [ {
        "term" : {
          "_type" : "category"
        }
      }, {
        "term" : {
          "guid" : "00f18254-27fe1f37-0127-fe1f4b9a-0000010d"
        }
      } ]
    }
  },
  "explain" : true
}


Add parsing of timezone-id in caldav query. Still not using timezone.

Remove a bunch of fields from BwAlarm associated with processing next alarm event. 
Was broken. Do processing while indexing or when needed. 
Added all alarm times to index so they are searchable.
 
Make UID filter test non-caseless 

Remove DTSTAMP ical4j adds when property list is specified. 
Also don't fail for unknown property in list.

Many changes to fix timerange queries for recurring events. Check to
see if an instance falls within the range specified.