Telescope uses the Elasticsearch search engine for full-text indexing. We use the @elastic/elasticsearch JavaScript module to interact with Elasticsearch in our code. In our tests, we use Jest Manual Mocks to provide mocks for Elasticsearch.
For information about installing Elastic, see our environment setup guide.
NOTE: You can mock the Elastic server using MOCK_ELASTIC=1
in your env, which
will let you run the backend without a real Elastic server.
- Interact with Elasticsearch outside of Telescope using one of the available clients.
- You can also interact with Elasticsearch's exposed
REST API
using a browser or cURL. - If you want to see the state of the cluster (
cURL
):
curl -X GET 'localhost:9200/_cluster/health?pretty'
- For listing all the indexes (
Browser
):
http://localhost:9200/_cat/indices?v
- You can query Elasticsearch using URL parameters (
Browser
):
http://localhost:9200/posts/_search?q=text:open%20source
- For more complex queries, you can use JSON (
cURL
):
curl -XGET --header 'Content-Type: application/json' http://localhost:9200/posts/_search -d '{
"query" : {
"match" : { "text":{ "query": "open source", "operator": "and", "fuzziness": "auto" }}
}
}'
- If you need to delete an index (using
posts
in thiscURL
example):
curl -X DELETE 'http://localhost:9200/posts'
- You can find a list of all available parameters for querying Elasticsearch here.