elasticsearch

Searching with Query Strings: Phrase Query

November 12, 2016 by
Part 22 of 35 in the Complete Guide to Elasticsearch series

In this article, we will be talking about using the phrase query when searching with query strings. By default, all terms are optional, as long as at least one term matches. This is because the default boolean operator is OR. We can see this if we search for pasta spaghetti. GET /ecommerce/product/_search?q=name:pasta spaghetti If we take… read more

Introduction to Searching

May 15, 2016 by
Part 19 of 35 in the Complete Guide to Elasticsearch series

Before we will get into actually performing searches against an Elasticsearch cluster, I want to introduce the basic concepts of searching in Elasticsearch. In this post, I will talk about relevancy and scoring in Elasticsearch. I will also briefly introduce the two ways of searching, as well as the various types of queries. Relevancy &… read more

Retrieving Documents by ID

January 17, 2016 by
Part 18 of 35 in the Complete Guide to Elasticsearch series

Now that we have added and manipulated documents within our Elasticsearch index, let’s now see how we can retrieve data from it. The easiest way of retrieving data in Elasticsearch, is by retrieving documents by ID. You actually saw this in the previous article if you were paying attention (gotcha!). Simply specify the ID of… read more

Batch Processing

January 17, 2016 by
Part 17 of 35 in the Complete Guide to Elasticsearch series

In the previous articles, we saw how to add, replace, update and delete individual documents. In this lecture, you will see how to perform these operations in batches. To do this, we will use something called the _bulk API. Performing operations in batches is very efficient because it limits the amount of network overhead. This is because… read more

Deleting Documents

January 17, 2016 by
Part 16 of 35 in the Complete Guide to Elasticsearch series

Now that we have added, replaced and updated a document, it is time to see how we can delete it. As you might have guessed, this can be done by using the DELETE HTTP verb. DELETE /ecommerce/product/1001 By default, it is only possible to delete documents by ID. However, there is a plugin named delete-by-query,… read more

Updating Documents

January 17, 2016 by
Part 15 of 35 in the Complete Guide to Elasticsearch series

Now instead of replacing a document, often times you will want to update it with some new information. Instead of replacing our entire product in order to change the price, we can just… well, change the price! This means that we don’t have to supply all of the fields again, but that we only have to pass in… read more

Adding Test Data

January 17, 2016 by
Part 12 of 35 in the Complete Guide to Elasticsearch series

Now that we have added mappings to our index, let’s add some test data to it so that we have some data to search in the remainder of the series. To do this, I will open up the terminal and issue an HTTP request with cURL, where I will be importing a JSON file. You… read more