Big Data search engine for full-text strings and photos with radius search
Nice Scenery
The find()
function also recursively digs through subdirectories. For the search engine to store the geodata in a way that optimizes the query performance, I need to add a mappings directive: The create()
command as of line 15 defines a geo_point
property by the name of Location
for the photo
document type used in the photos
index. The documentation for this [8] is out of date, by the way; the mapping it describes no longer works. I have, however, successfully tested Listing 4 with Elasticsearch release 1.0.0 RC2.
Starting with the jpeg images found by the search, line 32 in Listing 4 uses the IPhonePicGeo module to extract the geodata and pushes it, along with the file names, into the elastic database in the body
section of the index()
method starting in line 35.
After the data of all the photos has been indexed in this way, the script in Listing 5 retrieves all the snapshots that I took within 1km of the reference photo passed in at the command line. For this purpose, it ascertains the geodetic information of the reference image and then sends a match_all()
query, which returns all stored images. Line 23 turns on a filter that limits the geo_distance
to 1km. Additionally, the size
parameter increases the maximum number of hits to 100
.
Listing 5
photo-gps-match
This returns a list of photo objects, of which line 37 extracts the original file name and pushes it to the end of the array @files
. Finally, the system()
function in line 40 calls eog
(The Eye of Gnome application), which displays all the results as thumbnails (Figure 5). You can now click your way through them to explore the vicinity.
No Limits
The geo-function is just one of many plugin-like extensions of the Elasticsearch server, a useful tool that is easy to install and operate. It also scales practically infinitely because, as the volume of data increases, the administrator can distribute the indexes to a sufficiently large number of other Apache Lucene shards, to again run all queries with the required level of performance.
Books on paper and electronic form exist for Elasticsearch, but unfortunately, I can't really recommend any of them. That said, however, the tutorial [10] can be a help, and volunteers will answer questions on Stackoverflow.com.
Mike Schilli
Mike Schilli works as a software engineer with Yahoo! in Sunnyvale, California. He can be contacted at mschilli@perlmeister.com. Mike's homepage can be found at http://perlmeister.com.
Infos
- Elasticsearch download site: http://www.elasticsearch.org/overview/elkdownloads/
- Elasticsearch-1.03: http://search.cpan.org/~drtech/Elasticsearch-1.03/
- ElasticSearch-0.66: http://search.cpan.org/~drtech/ElasticSearch-0.66/
- Listings for this article: ftp://ftp.linux-magazin.com/pub/listings/magazine/162
- "Card Trick" by Mike Schilli: http://www.linux-magazine.com/w3/issue/95/072-076_perl.pdf
- "Don't Blame the Gardener" by Mike Schilli: http://w3.linux-magazine.com/issue/77/Perl_Linux-based_Gardening.pdf
- Elasticsearch documentation: http://www.elasticsearch.org/resources/
- Elasticsearch geo--distance filter: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-geo-distance-filter.html
- "New Bay Bridge spanning San Francisco Bay finally finished" by Mike Schilli: http://usarundbrief.com/103/index-en.html
- Elasticsearch tutorial: http://joelabrahamsson.com/elasticsearch-101/
« Previous 1 2 3
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Plasma 6.3 Ready for Public Beta Testing
Plasma 6.3 will ship with KDE Gear 24.12.1 and KDE Frameworks 6.10, along with some new and exciting features.
-
Budgie 10.10 Scheduled for Q1 2025 with a Surprising Desktop Update
If Budgie is your desktop environment of choice, 2025 is going to be a great year for you.
-
Firefox 134 Offers Improvements for Linux Version
Fans of Linux and Firefox rejoice, as there's a new version available that includes some handy updates.
-
Serpent OS Arrives with a New Alpha Release
After months of silence, Ikey Doherty has released a new alpha for his Serpent OS.
-
HashiCorp Cofounder Unveils Ghostty, a Linux Terminal App
Ghostty is a new Linux terminal app that's fast, feature-rich, and offers a platform-native GUI while remaining cross-platform.
-
Fedora Asahi Remix 41 Available for Apple Silicon
If you have an Apple Silicon Mac and you're hoping to install Fedora, you're in luck because the latest release supports the M1 and M2 chips.
-
Systemd Fixes Bug While Facing New Challenger in GNU Shepherd
The systemd developers have fixed a really nasty bug amid the release of the new GNU Shepherd init system.
-
AlmaLinux 10.0 Beta Released
The AlmaLinux OS Foundation has announced the availability of AlmaLinux 10.0 Beta ("Purple Lion") for all supported devices with significant changes.
-
Gnome 47.2 Now Available
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.