liveBook · Manning

URI request

As explained in Elasticsearch in Action, Second Edition

An Elasticsearch search request that expresses query parameters in the request URI rather than in a Query DSL request body.

A URI request searches Elasticsearch by attaching query parameters to the _search URL instead of sending criteria in a Query DSL request body. It suits simple searches that fit name:value expressions. section 8.4.1 section 8.6

Find movies by title

GET movies/_search?q=title:Godfather The query follows the question-mark delimiter and uses title:Godfather as its name:value criterion. It can return movies matching “Godfather” in the title, such as the trilogy. section 8.4.1 section 8.6

GET|POST <your_index_name>/_search?q=<name:value> AND|OR <name:value>

Use the compact request pattern to combine simple criteria with AND or OR. section 8.6

Keep these operational distinctions in mind:

  • Target one index, multiple comma-separated indexes or aliases, or all indexes by omitting the index scope. section 8.5.1
  • Prefer Query DSL when criteria become complex because it is more powerful, expressive, and supports advanced queries and aggregations. section 8.4.1 section 8.9
  • Use the _search endpoint through GET or POST when issuing the URI form. section 8.4.1

How Elasticsearch in Action, Second Edition covers it

How deep it goes
Defines q=name:value syntax and index scope, but stops short of the complex criteria supported by Query DSL.
Examples
Uses a movies search for title:Godfather and a compact AND/OR request pattern.
What it assumes
Assumes basic REST endpoint and index knowledge while introducing the URI alternative to JSON Query DSL searches.
What you can do after
Apply Elasticsearch’s _search endpoint to issue simple GET or POST searches with URL query parameters.
How it connects
Connects the _search endpoint with Query DSL, search requests, search responses, and index or alias scope.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Elasticsearch in Action, Second Edition. The section links point to the parts of the book it draws on.