-1

how to search multi types data in elasticsearch just like db's compound query. I am a green hand about elasticsearch ,I want to kown how to query data which in diffrent types.

qsmy_qin
  • 9
  • 1
  • 4

2 Answers2

0

You can do this by putting comma between your types or indexes. For example, check the below example to match all your docs your multiple type

GET books/fiction,adventure/_search
{
    "query": {
        "match_all": {}
    }
}

And also, you can search on multiple indexes:

GET logstash-*/warning/_search
{
    "query": {
        "match_all": {}
    }
}

With this query, you can search on all the indexes whose name is start with "logstash-" or like type, comma will work for indexes.

You can check this doc to get more information.

hkulekci
  • 1,894
  • 15
  • 27
0

I am not sure if i understood you correctly but in ES you can search acroos multiple indexes and types see link

GET /twitter/tweet,user/_search?q=user:kimchy

This will search on tweet and user types

Vova Bilyachat
  • 18,765
  • 4
  • 55
  • 80