Earlier chapters have covered searching data using term-level and full-text queries. We’ve also looked at advanced queries like bool, boosting, and others. To continue building on what we’ve discussed and advance the query landscape, this chapter introduces several kinds of specialized queries.
We begin by looking at searches aimed at geolocations. Common use cases involving geoqueries include searching nearby restaurants for a delivery order, finding directions to a friend’s house, locating popular schools within a 10 km range, and so on. Elasticsearch has first-class support for satisfying such location-related searches. It also provides several geospatial queries: geo_bounding_box, geo_ distance, and geo_shape.
Next, we examine how to search two-dimensional (2D) shapes using shape queries. Design engineers, game developers, and others can search in an index of 2D shapes. Then we look at low-level positional queries called span queries. Although full-text and term-level leaf queries help us search for data, they can’t find words in a particular order, their position, the exact (or approximate) distance between words, and so on. This is where span queries come into play.