Soumitra Dutta Oxford-How do I run a basic search query?

Hi everyone, My name is Soumitra Dutta an entrepreneur & photographer. I’m currently learning OpenSearch and trying to understand how to run a basic search query, and I’d really appreciate your suggestions.

Regards

Soumitra Dutta

Hi @soumitradutta26, thank you for the question.

Simple Match Query (most common starting point):

GET /your-index-name/_search
{
  "query": {
    "match": {
      "your_field": "your search term"
    }
  }
}

A few practical examples to explore:

1. Match All Documents

GET /your-index-name/_search
{
  "query": {
    "match_all": {}
  }
}

2. Search Across Multiple Fields

GET /your-index-name/_search
{
  "query": {
    "multi_match": {
      "query": "landscape photography",
      "fields": ["title", "description", "tags"]
    }
  }
}

3. Filter by Exact Value + Search (Bool Query)

GET /your-index-name/_search
{
  "query": {
    "bool": {
      "must": { "match": { "category": "portrait" } },
      "filter": { "term": { "status": "published" } }
    }
  }
}

4. Limit Results & Paginate

GET /your-index-name/_search
{
  "query": { "match_all": {} },
  "from": 0,
  "size": 10
}

Tips to get started quickly:

  • Use OpenSearch Dashboards Dev Tools, it’s the easiest way to run queries interactively
  • match is for full-text search (tolerates typos, stemming); term is for exact matches
  • Always check your index name with GET _cat/indices?v
  • The OpenSearch documentation on Query DSL is excellent.