We've recently posted articles on topics ranging from simple scripting to advanced methods in scripting to eliminating duplicates in your indexes.

Here in this tutorial, we help you learn how to combine the script_fields and geo_point methods to generate examples that you can use for modeling in a wide variety of real-world applications. We also give a brief introduction of the Explain API, which is a good aid in understanding how Elasticsearch computes document scores.

Keep reading

The script fields feature in Elasticsearch gives users the ability to return a script evaluation for each hit, according to the values taken from different fields. Script fields can work on temporary fields that won't be stored, and they can return the final evaluation of the script as a custom value. Script fields can also access a source document from the index and extract specific elements.

This article provides a short tutorial on the use of script fields, and we also look at the basics of Elasticsearch logging during script execution.

Keep reading

In Elasticsearch, field data is generated at query time by reading the index, inverting that data structure, and then storing the results in memory. This operation can be quite slow, and it often consumes far too much valuable heap space. Before you know it, your cluster is grinding slowly toward a state of complete lethargy -- but it need not be so! In this article, we present a summary of a recent Elastic article on the challenges and corresponding remedies for overgrown field data.

Keep reading

This is a continuation of our extensive blog series on Elasticsearch scripting, which includes tutorials and example scripts for sorting, filtering, and scoring. In our previous article, we went through a basic tutorial on performing aggregations in Elasticsearch using scripts.

In this tutorial we move on to more advanced operations: computing term frequencies, reshaping the results of extended_stats aggregations, and implementing scripted_metric aggregations.

Keep reading

This is a continuation of our long-running blog series on Elasticsearch scripting, which includes tutorials and example scripts for sorting, filtering, and scoring. In this article, we move on to various scripting options that are available for managing ES aggregations.

A developer often doesn't get the expected results when using default aggregations. There are also limitations with the basic aggregation features. This is the case, for example, if we want to alter the offset values for a histogram. Since Elasticsearch doesn't provide this native capability, we use scripts to get the results we want. We also cover several other aggregation tasks using scripts.

Keep reading

Elasticsearch users employ scoring to give a higher weight to documents that meet specific criteria. As we show with several examples in our previous article on scoring, the objective is often to get a list of documents with a sorting on the relevance to the search. Relevance is the numerical output of an algorithm that gives a measure of how a particular document is textually similar to the query. Elasticsearch employs and enhances standard scoring algorithms and encapsulates these within its script_score and function_score features.

This article is a continuation of our lengthy tutorial series on scripting in Elasticsearch, and it goes further than the scoring basics that we cover in the previously. Here, we explore advanced scoring techniques using decay functions. We provide a few permutations of a geographical search example, provide example code, and show the results.

Keep reading