elasticsearch match vs term query

Solution 1:

Assuming you are using the Standard Analyzer GET becomes get when stored in the index. The source document will still have the original "GET".

The match query will apply the same standard analyzer to the search term and will therefore match what is stored in the index. The term query does not apply any analyzers to the search term, so will only look for that exact term in the inverted index.

To use the term query in your example, change the upper case "GET" to lower case "get" or change your mapping so the request.method field is set to not_analyzed.

Solution 2:

The difference between term and match in elasticsearch

Term is an exact query

Match is a fuzzy query

The term is a perfect match, that is, an exact query. The search term will not be segmented before the search, so our search term must be one of the document segmentation sets. Let’s say we want to find all the documents titled Jesus Verma.

 $curl -XGET http://localhost:9200/index/doc/_search?pretty -d 
'{
  "query":{
    "term":{
"title": "Jesus Verma"
    }
  }
}'

The match query will first classify the search words. After the word segmentation, the word segmentation results will be matched one by one. Therefore, compared to the exact search of term, match is a participle match search, and match search has two variants of similar functions. One is match_phrase. One is multi_match

$curl -XGET http://localhost:9200/index/doc/_search?pretty -d 
'{
    "query": {
        "match": {
 "content": "Banglore, India"
        }
    }
}'