-->

Elasticsearch to query across multiple indices and

2019-09-15 11:44发布

问题:

I am newbie to elasticsearch .I am using AWS elastic search instance 5.1.1. I have a requirement where I need to specify multiple indices and types in request body of Elasticsearch for search operation ,is it possible ? What is the simplest way to do it an example would be appreciated. Thanks in advance !

回答1:

Referring back to documentation you can try doing a simple CURL as below

curl -XGET 'localhost:9200/_search?pretty'

This should ideally query across all indices and types.

Hope This helps!



回答2:

When creating Canonical Request you need to URI encode with escape character like

>  str.replaceAll("%20", " "))).toString()
>                 .replaceAll("%3A", ":")
>                 .replaceAll("%2F", "/")
>                 .replaceAll("%3B", ";")
>                 .replaceAll("%40", "@")
>                 .replaceAll("%3C", "<")
>                 .replaceAll("%3E", ">")
>                 .replaceAll("%3D", "=")
>                 .replaceAll("%26", "&")
>                 .replaceAll("%25", "%")
>                 .replaceAll("%24", "$")
>                 .replaceAll("%23", "#")
>                 .replaceAll("%2B", "+")
>                 .replaceAll("%2C", ",")
>                 .replaceAll("%3F", "?");