Searching fields for specific values

curl -XPOST localhost:9200/index/_search -d'{
  "query": {
    "match": {
      "topic": "hello world"
    }
  }
}'

That searches in a topic field in the index named index that contains the words hello and world in any order with any proximity to one another. You could also do this:

curl -XPOST localhost:9200/index/_search -d'{
  "query": {
    "match_phrase": {
      "topic": "hello world"
    }
  }
}'

That searches in a topic field in the index named index that contains the words hello and world in that order without any words between them.

Here are some important docs to read:
https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis.html
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html

1 Like