Use SQL in Elasticsearch to download data from the search index.

Important Information

Credentials for Elasticsearch https://localhost:9200 Username : admin Password : xxxxx

## **Viewing Results from Elasticsearch**

Using SQL, you can view search results directly from Elasticsearch using the following URL



You can also export the results in CSV format using the following URL



## **Basic Queries**

Use the following queries for specific search results you need.

**Queries for specific file types:**



**Queries for specific URL or filename:**



**Queries for specific keywords:**



**Results from multiple indices:**



**Results with only URLs from indices:**



**Query with ORDER BY:**



**Query with LIMIT:**



**Query with INCLUDE, EXCLUDE:** Use exclude ('fieldname') and include ('fieldname') to exclude fields or include fields in display. Partial name of fields can be given along with * character.



Important Information:

All fields within Elasticsearch can be accessed using SQL.

## **Aggregations**

**Using GROUP BY and COUNT:** Group by and count together can be used to determine the count of file types in results.



Group by can be also used to determine sentiment in sentiment analysis.



**Query with sum function:**



**Queries with min and max functions:**



**Queries with statistic functions:**



## **Beyond SQL features**

**Query with IS MISSING, IS NOT MISSING:**



**Query to search for multiple terms using IN_TERMS:**



**Query to search for a specific term using TERM:**



**Special queries related to statistics that can be used in Elasticsearch:**