gettint error 400 with AJAX

i can’t see the action parameter in your code

it should be:

let ajax = new XMLHttpRequest();
ajax.open("GET", search_x.ajaxurl + '?action=search_data', true);
ajax.send();

ajax.onreadystatechange = function() {
  if (this.readyState == 4 && this.status == 200) {
    console.log(this.ajax);
  }
};

see this reference about action parameter https://codex.wordpress.org/AJAX_in_Plugins