javascript:
function url_domain(url){
  var a=document.createElement('a');
  a.href=url;
  return a.hostname;
}
function lowerCaseString(s){
  if(s){
    return s.toLowerCase();
  }
  return "";
}
var esDoc={};
var mhl=document.links;
var ds={};
for(var i=0;i<mhl.length;i++){
  var l=mhl[i];
  var d=url_domain(l.href);
  if((d.length>0)&&(l.text.length>0)){
    var dls=ds[d];
    if(!dls){
      dls=[];
      ds[d]=dls;
    }
    dls.push(l.text);
  }
}
var canonicalUrl="";
var mhl=document.getElementsByTagName("link");
for(var i=0;i<mhl.length;i++){
  if(mhl[i].getAttribute("rel")==="canonical"){
    canonicalUrl=mhl[i].getAttribute("href");
    console.log("canon="+canonicalUrl);
    break;
  }
}
esDoc.description=window.title;
var mhl=document.getElementsByTagName("meta");
for(var i=0;i<mhl.length;i++){
  var prop=lowerCaseString(mhl[i].getAttribute("property"));
  var name=lowerCaseString(mhl[i].getAttribute("name"));
  if(prop==="og:url"){
    canonicalUrl=mhl[i].getAttribute("content");
  }
  if(prop==="og:description"){
    esDoc.description=mhl[i].getAttribute("content");
  }
  if(name==="description"){
    esDoc.description=mhl[i].getAttribute("content");
  }
  if(prop==="og:image"){
    esDoc.image=mhl[i].getAttribute("content");
  }
}
if(canonicalUrl.length==0){
  canonicalUrl=window.location;
}
var note=prompt("Save note",document.title);
if(note){
  esDoc.title=note;
  esDoc.outboundDomainLinks=[];
  for(url in ds){
    esDoc.outboundDomainLinks.push(url);
  }
  var x=new XMLHttpRequest();
  //Avoid any contamination of array behaviour by the current web page- see http://stackoverflow.com/questions/710586/json-stringify-bizarreness
  if(window.Prototype) {
      //Caution!! The "compress" function in this bookmarket builder (http://subsimple.com/bookmarklets/jsbuilder.htm ) loses the 
      // space between "delete" and "Array" in the line below and needs fixing
      delete Array.prototype.toJSON;
  }
  var string=JSON.stringify(esDoc);
  x.open('POST',"http://localhost:9200/bookmarks/bookmark/"+encodeURIComponent(canonicalUrl),true);
  x.setRequestHeader("Content-type","application/x-www-form-urlencoded");
  x.send(string);  
}