Best way to create dynamic table for search There is a table of documents:

CREATE TABLE `docs` (
  `doc_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `doc_uuid` binary(16) NOT NULL,
  `sender_uuid` varchar(40) NOT NULL,
  `receiver_uuid` varchar(40) DEFAULT NULL,
  `chain_id` int(10) unsigned NOT NULL,
  `status` tinyint(4) NOT NULL COMMENT 'open,sent,inbox,read,etc',
  `date_created` int(10) unsigned NOT NULL DEFAULT '0',
  `date_changed` int(10) unsigned NOT NULL DEFAULT '0',
  `date_read` int(10) unsigned NOT NULL,
  `doc_date` int(10) unsigned NOT NULL,
  `doc_number` varchar(50) NOT NULL,
  `is_archive` tinyint(1) NOT NULL DEFAULT '0',
  `doc_hash` binary(16) NOT NULL COMMENT 'md5 of document data,
  PRIMARY KEY (`doc_id`),
  ... keys ...
) ENGINE=InnoDB DEFAULT CHARSET=utf8


which contains the mandatory fields in the document.

And I have a tables with document "indexes"

CREATE TABLE `docs_idexes` (
  `doc_id` int(10) unsigned NOT NULL,
  `created_from` binary(16) DEFAULT NULL,
  `is_signed` tinyint(1) NOT NULL DEFAULT '0',
  `encrypted` tinyint(1) NOT NULL DEFAULT '0',
  `file_name` varchar(255) DEFAULT NULL,
  `file_date` int(10) unsigned DEFAULT NULL,
  `inv_date` int(10) unsigned DEFAULT NULL,
  `inv_num` varchar(20) DEFAULT NULL,
  `error_code` int(10) unsigned DEFAULT NULL,
  `sub_doc_type_id` smallint(5) unsigned DEFAULT NULL,
  `sub_status_id` smallint(5) unsigned DEFAULT NULL,
  `action` tinyint(3) unsigned DEFAULT NULL,
  `buyer_uuid` varchar(40) DEFAULT NULL,
  `consignee_uuid` varchar(100) DEFAULT NULL,
  `consignor_uuid` varchar(40) DEFAULT NULL,
  `customer_uuid` varchar(40) DEFAULT NULL,
  `performer_uuid` varchar(40) DEFAULT NULL,
  `supplier_uuid` varchar(40) DEFAULT NULL,
  `delivery_place_uuid` varchar(40) DEFAULT NULL,
  `contract_date` date DEFAULT NULL,
  `contract_number` varchar(35) DEFAULT NULL,
  `delivery_date` int(10) unsigned DEFAULT NULL,
  `order_number` varchar(35) DEFAULT NULL,
  `order_date` int(10) unsigned DEFAULT NULL,
  `return_date` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`doc_id`),
  ... keys ...
) ENGINE=InnoDB DEFAULT CHARSET=utf8


The problem is that the indexes will be added every month. And run ALTER TABLE is bad idea.

What is best way to create a database architecture without ALTER TABLE when I add a new index?
You could use an unstructured column type like XML or JSON. But MySQL doesn't support these types AFAIK. You could store these types as a string in MySQL but I wouldn't recommend that. The reason for that is if you need to change one value in the XML/JSON you would need to change the whole string or somehow parse it with with RegEx. Nasty.

So to use an unstructered type you would need to move to a different RDBMS. MariaDB has some JSON support. Switching from MySQL to MariaDB should be an easy migration, see this guide from DigitalOcean.

If you don't want to change RDBMS then I think the EAV model mentioned by Phil is the best choice although these tend to degrade in performance as the data grows. Filtered indexes can help but they too AFAIK are not available in MySQL.