Bo Andersen
I am a back-end web developer with a passion for open source technologies. I have been a PHP developer for many years, and also have experience with Java and Spring Framework. I currently work full time as a lead developer. Apart from that, I also spend time on making online courses, so be sure to check those out!
Posts by Bo Andersen
Aggregations
Aggregations are a way of grouping and extracting statistics from your data. In case you are familiar with relational databases, you can think of this as the equivalent of SQL’s GROUP BY clause and aggregate functions such as SUM. Interestingly, Elasticsearch provides a rather powerful feature that allows you to execute searches and return hits… read more
Sorting Results
In this article we will be taking a look at how to sort the search results. When retrieving documents from Elasticsearch, it is possible to sort the search results. If you are familiar with relational databases, then this is equivalent of the ORDER BY query clause. I will perform a search for the term pasta… read more
Pagination
In this article, you will learn how to do pagination in Elasticsearch. In the previous article, I introduced the size parameter, which I will also be using to paginate through search results. While the size parameter specifies how many documents should be returned in the results, the from parameter specifies which document index to start… read more
Changing the Size of Result Sets
In this article I will show you how to change the number of documents returned in the result set. I will start by showing you how to do it with query string searches. It’s as simple as adding a size parameter as I will show you in the following query. GET /ecommerce/product/_search?q=name:pasta&size=2 Notice that I… read more
Filtering Results
This article explains how to filter results. Remember that there are two query contexts; the query context and filter context. Queries that are in query context affect the relevance scores of documents depending on how well they match, while queries in a filter context do not affect relevance scores. Therefore, filter queries can be used… read more
Boosting
This article explains how to boost terms and query clauses when searching in Elasticsearch. When searching for multiple terms, it is sometimes useful to be able to assign a higher or lower priority to certain terms. Elasticsearch provides a way of doing this by specifying a positive floating point number. Below is an example query.… read more
Proximity Searches
Now that we have taken a look at fuzzy searches, it’s time to take a quick look at proximity searches, which are somewhat related. We looked at phrase searches in a previous lecture, where the search query is enclosed within quotation marks and the terms must be in the correct order. A proximity search allows… read more
Fuzzy Searches
In the previous lectures, I showed you how to perform a variety of searches. For full text searches, the exact terms that I was searching for had to match somewhere in the document. But what if a user enters something that is not an exact match, but should still be considered a match? For example,… read more
Searching Across Indexes and Types
In this article, I will show you how you can search across indexes and mapping types, rather than having to explicitly define which index and mapping type to search. Before showing you examples of how to do this, I will just add a new index and a new mapping type for demonstration purposes, so that… read more
Searching with Query DSL: Compound Queries
Now that I have shown you how to use full text and term level queries with the query DSL, it’s time to take a look at compound queries. Remember that compound queries consist of leaf queries or other compound queries. To start off, I will perform a simple search that uses simple boolean logic. The… read more