0

I have two search terms "86746184549" and "3302093809". I am executing two separate term queries to fetch one document matching each of the ids.

"size":1,
"query":{
  "term":{
    "from_user_id": "86746184549"
  }

}

and

"size":1,
"query":{
  "term":{
    "from_user_id": "3302093809"
  }

}

Is there are a way to combine these 2 queries, something similar to what we do in facets.

 {
    "facets":{
      "facet_1":{

       },
      "facet_2":{

       },
      "facet_3":{

       }  
    }
 }

I don't think the terms query will work here because, that wont return documents containing distinct from_user_id field.

The reason I want to combine the queries is because, say if I have 100 such terms then I will be making 100 calls!! to the elasticsearch server.

4

1 に答える 1

2

まだ実装されていないelasticsearchの非常に人気のある機能であるFieldCollapsing /Combiningを探しているようです。一方、マルチ検索を使用して、複数の用語リクエストを1つにまとめることができます。

于 2012-11-01T14:31:40.100 に答える