Elasticsearch to query across multiple indices and multiple types

旧街凉风 提交于 2019-12-12 02:08:14

问题


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", "?");


来源:https://stackoverflow.com/questions/42633177/elasticsearch-to-query-across-multiple-indices-and-multiple-types

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!