0

I am using multi_match search in Elasticsearch. How can I return all data using multi_match?

I would like to do something like this: curl -XGET 'http://localhost:9200/routines/_search?pretty=true&q=*:*' but using the structure of multi_match that I have when I search for specific phrases.

My query looks like this:

{
            query: {
                bool: {
                    should: [
                        {
                            nested: {
                                path: "steps",
                                query: {
                                    nested: {
                                        path: "steps.products",
                                        query: {
                                            multi_match: {
                                                query: *,
                                                fields: [
                                                    "steps.products.name"
                                                ]
                                            }
                                        }
                                    }
                                }
                            }
                        },
                        {
                            multi_match: {
                                query: *,
                                fields: [
                                    "title"
                                ]
                            }
                        }
                    ]
                }
            }
        }

I wish I could use * to match all the results but it doesn't work. How can I keep this query and change only the value set for query?

Norah Jones
  • 427
  • 5
  • 17

1 Answers1

0

The multi-match query allows us to run a query on multiple fields. It is an extension of the match query.

When you search for specific phrases with no field specified, using a multi-match query, then that defaults to extracting all the fields as mentioned in the official documentataion

{
  "query": {
    "multi_match" : {
      "query":    "your-phrase"
    }
  }
}
ESCoder
  • 15,431
  • 2
  • 19
  • 42
  • I've updated the question. Could you take a look? You current answer doesn't help me unfortunately. – Norah Jones Apr 17 '21 at 15:25
  • @NorahJones I didn't get. May I know why you want to use `*` to match all the results, of a particular field? – ESCoder Apr 17 '21 at 16:44