In order to continue providing reliable GFD (great freakin’ data) to our clients, the product development team here at gap intelligence recently upgraded our core application from Rails 4.2 to 5.0, a very necessary and complex update that took over 8 weeks to complete. A good portion of any major upgrade is testing and while in the process of testing, I ran into some Elastic Search issues with our API.
What is ElasticSearch?
A document-oriented database that allows you to store, retrieve, and manage document-oriented data through it’s open source API. At gap intelligence, we use it to power faster and efficient searches for information in our massive database of GFD. I wanted to share some useful ElasticSearch commands I used to help me troubleshoot some API issues.
Check your Elasticsearch Connection
If your ES powered API isn’t returning the expected results, first rule out a connection issue with:
List All Your Indices
Once you’ve established your connection works, check your indices and make sure the ones you’re looking for are there:
Delete an Index:
If you find a bad index and need to remove it, simply delete it with:
Check Your Index Aliases
Test a Query
Check to see if an ES query returns the expected response. If it does, you know the issue isn’t with your ElasticSearch setup:
Here’s an example with search parameters:
List your Index Mapping
You can check if the correct fields are being mapped in your indices, as well as the correct types and formats. This can help verify if you’re searching with the correct params in your ES queries.
ElasticSearch is a vast, complex, and powerful tool and can sometimes be intimidating to utilize and navigate. Fortunately, their website provides thorough and detailed documentation to help developers implement it into our applications. I found the above commands from that same documentation very helpful while working on our own API and I hope you will find them useful as well.
Do you have what it take to be a gapper? Our Product Development team is hiring. Head to our culture section to learn more about open positions. We’re conducting phone interviews as we work towards flattening the curve. Stay safe and healthy. We’re all in this together.