Will you really need to aggregate over parts of URLs? I suspect not. You could just index it twice: once with type:text and once with type:keyword
and index:false
. The first field will be useful to search over url parts and the second field will be be useful to aggregate entire urls.