join the nosql movement of the number of times term is found in the result set as opposed to all the other documents this way elasticsearch profiles your result set by supplying the keywords that distinguish it from the other data let' do that on diabetesa common disease that can take many formslisting significant terms elasticsearch query for "diabetesthe dictionary named searchbody contains the search request information we'll send we want the name field in our results filtered query has two possible componentsa query and filter the query performs search while the filter matches exact values only and is therefore way more efficient but restrictive the filter part of the filtered query query part isn' mandatorya filter is sufficient the query searchbody=part "fields":["name"]"query":"filtered"filter"'term'{'name':'diabetes'we want to filter the name field and keep only if it }contains the term diabetes "aggregations"diseasekeywords"significant_terms"field"fulltext""size": client search(index=indexname,doc_type=doctypebody=searchbodyfrom_ searchfromsize=searchsizediseasekeywords is the name we give to our aggregation an aggregation can generally be compared to group by in sql it' mostly used to summarize values of numeric variable over the distinct values within one or more variables significant term aggregation can be compared to keyword detection the internal algorithm looks for words that are "more importantfor the selected set of documents than they are in the overall population of documents you see new code here you got rid of the query string search and used filter instead the filter is encapsulated within the query part because search queries can be combined with filters it doesn' occur in this examplebut when this happenselasticsearch will first apply the far more efficient filter before attempting the search if you know you want to search in subset of your datait' always good idea to add filter to first create this subset to demonstrate thisconsider the following two snippets of code they yield the same results but they're not the exact same thing