## 3 The Application Architecture and Databases
### Using Non-Relational Elasticsearch and MySQL Document Store  
Elasticsearch is a search engine where the information is stored in the form of documents and has been created to store, retrieve, and make data management, having its own mechanism for queries. Elasticsearch is a document-based search engine, and each entry is a structured JSON document [8].  
Elasticsearch is a near-real-time search platform that allows data search as soon as the document was indexed. Elasticsearch allows dividing the data between several clusters, which makes it possible to support high-performance operations [1]. Each cluster represents one or more servers that store information and provide the ability to search for data. A cluster can have many nodes, in which each node represents an Elasticsearch instance [12]. A node is a single server that holds part of the data and participates in the data indexing and querying processes. The parts between which data is divided are called shards. Shards come in two types--master and replica. The master allows both read and write operations, while the replica is read only, and is an exact copy of the master. Such a structure ensures the stability of the system, since in the event of a master failure, the replica becomes a master [10]. In the developed application, a single node cluster was used and distributed the documents in a single shard with no replicas.  
MySQL Document Store allows storing rows from relational tables in the JSON format within collections. It allows developers through the X Dev API to work with relational tables and JSON document collections. The X DEV API provides an easy-to-use API for performing CRUD operations, being optimized and extensible for performing these operations.  
MySQL Document Store offers flexibility in developing applications with non-relational databases as well as traditional SQL database applications. This eliminates the need for a separate non-relational database. Developers can use relational data and JSON documents in the same database as well as in the same application.  
Elasticsearch allows the indexing of data in JSON format, which is much easier to view and process as opposed to the rows in each table. An index is a collection of documents that have similar characteristics and assume that their name is unique to be able to perform the search, delete, and update operations.  
In the developed application, in order to be able to compare the efficiency of the queries, multiple columns from _car announcements_ were indexed both in Elasticsearch as well as in MySQL Document Store to have the following structure:_id_\":10006\", \"price\":8900, \"carMake\":\"Audi\", \"carType\":\"USED\", \"carModel\":\"A4\", \"carImages\":L\", \"engineDeatail\":1 \"power\":\"184\", \"fuelType\":\"DIESEL\", \"serialNumber\":\"55\", \"emissionClass\":\"Euro 5\", \"engineCapacity\":2000, \"transmissionDetail\":[ \"serialNumber\":\"123121\", \"transmissionType\":\"AUTOMATIC\" ] ], \"exteriorSpec\":[ \"color\":\"blue\", \"carBody\":\"SEDAN\", \"numberOfDoors\":5, \"exteriorOptions\":[ ] ], \"interiorSpec\":[ \"numberOfSeats\":4, \"interiorOptions\":[ ] ], \"airConditioningType\":\" AUTOMATIC\" ], \"sensorDetails\":[ { \"sensorType\":\"LIGHT_SENSOR\", \"sensorPosition\":\"FRONT\" ] ], \"kilometresNumber\":189000, \"carAnnouncementNo\":10006, \"firstRegistrationYear\":\"2010\"  
The above structure represents the non-relational alternative to the relational one presented in Figure 1. The main benefit of using Elasticsearch and MySQL Document Store in this case is that it avoids making joins between all the tables mentioned above.