Regression using Neural Network

Keras a warpper API that runs on top of Tensorflow or theano is very popular and easy to use. Scikit learn also very popular libraries for machine learning.In this post I will show how to use keras…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Symfony ElasticSearch

Current article is the introduction to the practice series of articles devoted to theme “How to work with ElasticSearch using Symfony PHP framework”. You may treat it as Symfony ElasticSearch tutorial though you will get also additional deep knowledge at how to build search microservice from scratch, how to use programming patterns at real examples. So, lets start from task definition and requirements. What we really want to achieve is reflected at next list:

We will start with creating according microservice environment. Using docker and docker compose, we will create web server, microservice application by itself and ElasticSearch as a separate docker containers

Then we will continue with creating our code using the architecture scheme represented below. Our search request would be processed by a controller where we will first create a criteria DTO object. That will create an abstract layer between the front world and our backend logic. You may look at it also from another side, e.g as our search service will have its own interface to work with. Such an approach will allow us to be flexible in changing url parameters. From another side, using the builder pattern we would be able easily change the source and type of request by itself. For example we can expose search additionally for some external microservice that will be integrated with our system within some queue message broker. Next we will pass our DTO search criteria object to the search service that will be responsible for representing search results and calling the query builder object. Query builder will be using a filter design pattern to construct our final ElasticSearch query using an object oriented approach. It would be also responsible for adding sort, paging and aggregations parameters. In addition our microservice will keep a model data layer that will project ElasticSearch document structure to according classes.

Below is the representation of the builder design pattern that we will use to create a DTO search criteria object. The builder pattern is a design pattern designed to provide a flexible solution to various object creation problems in object-oriented programming. The intent of the Builder design pattern is to separate the construction of a complex object from its representation. In our simplified example the search criteria object would not be very complicated but in real practice we can easily have even 50 search parameters. And such an approach would be very helpful.

We will also get acquainted with filter design patterns. That will help to organise our code for creating complicated ES queries.

Add a comment

Related posts:

Think like a PROgrammer

My definition of a PROgrammer is a coder that aims to produce professional quality code. It is a state of mind that unites coders beyond the language barriers.