If you send a GET the body is probably not even sent to elasticsearch, so you are basically sending no query to the _search
endpoint, which is why you are getting everything back (of course only the first 10 results based on the default size parameter).
Have a look at the URI request, which allows you to send basic queries using the q
parameter within the URI. You can use the Lucene query syntax and specify some other parameters listed in the linked page. If you then want to execute more advanced queries, you might want to express them as JSON queries in order to get all the benefits of the elasticsearch Query DSL, but you'd need to provide them as body of the request.
UPDATE
Looking deeper at the elasticsearch head plugin, the query is not sent as the request body when you select the GET method but within the URL itself and without specifying the name for the parameter, like this:
http://localhost:9200/_search&{"query":{"term":{"text":"john"}}}
That is probably a bug in the plugin itself and elasticsearch can't find the query, that's why you get all the results back. That means that only the POST method works while sending queries with elasticsearch head.
Elasticsearch allows to use both GET and POST for executing queries. If you use GET you can either send the query as body or use the source parameter like this:
http://localhost:9200/_search?source={"query":{"term":{"text":"john"}}}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…