# Multisearch questions: facets and query string

**URL:** <https://discuss.elastic.co/t/multisearch-questions-facets-and-query-string/12178>\
**Category:** Elasticsearch\
**Created:** [May 29, 2013, 9:49pm UTC](https://discuss.elastic.co/t/multisearch-questions-facets-and-query-string/12178 "2013-05-29T21:49:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![benq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benq/32/1428_2.png) [@benq](https://discuss.elastic.co/u/benq)\
**Post date:** [May 29, 2013, 9:49pm UTC](https://discuss.elastic.co/t/multisearch-questions-facets-and-query-string/12178/1 "2013-05-29T21:49:07Z")

</div>

Hi,

I do a multisearch with:  
{}  
{"query" : { "term" : {"category" : "sport"} }, "facets" : {"text\_t1" :  
{"terms" : {"field" : "tags1", "size" : 20}}}}

{}  
{"query" : { "term" : {"category" : "sport"} }, "facets" : {"text\_t2" :  
{"terms" : {"field" : "tags1", "size" : 20}}}}

(twice the exact same request).

And, I get:  
$ curl -XGET 'localhost:9200/\_msearch?search\_type=count&pretty=1'  
--data-binary @requests; echo  
{  
"responses" : [ {  
"took" : 3,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 6,  
"max\_score" : 0.0,  
"hits" : []  
},  
"facets" : {  
"text\_t1" : {  
"\_type" : "terms",  
"missing" : 0,  
"total" : 6,  
"other" : 0,  
"terms" : [ {  
"term" : "extérieur",  
"count" : 2  
}, {  
"term" : "autre",  
"count" : 2  
}, {  
"term" : "nouveau",  
"count" : 1  
}, {  
"term" : "intérieur",  
"count" : 1  
} ]  
}  
}  
}, {  
"took" : 3,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 10,  
"max\_score" : 0.0,  
"hits" : []  
}  
} ]  
}

Why do I get only text\_t1 facet (and not text\_t2)?  
Why is the hits total different?

Last question: Is it possible to pass the queries as url parameter for a  
multisearch (my client doesn't let me define bodies for GET requests)?

Thanks for your help.

Benoît

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 30, 2013, 5:18am UTC](https://discuss.elastic.co/t/multisearch-questions-facets-and-query-string/12178/2 "2013-05-30T05:18:02Z")

</div>

Is there an empty line between both requests?  
It should not.

If you can reproduce it, can you create a full curl recreation, gist it and open an issue?

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 29 mai 2013 à 23:49, benq [benoit.quartier@gmail.com](mailto:benoit.quartier@gmail.com) a écrit :

Hi,

I do a multisearch with:  
{}  
{"query" : { "term" : {"category" : "sport"} }, "facets" : {"text\_t1" : {"terms" : {"field" : "tags1", "size" : 20}}}}

{}  
{"query" : { "term" : {"category" : "sport"} }, "facets" : {"text\_t2" : {"terms" : {"field" : "tags1", "size" : 20}}}}

(twice the exact same request).

And, I get:  
$ curl -XGET 'localhost:9200/\_msearch?search\_type=count&pretty=1' --data-binary @requests; echo  
{  
"responses" : [ {  
"took" : 3,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 6,  
"max\_score" : 0.0,  
"hits" : []  
},  
"facets" : {  
"text\_t1" : {  
"\_type" : "terms",  
"missing" : 0,  
"total" : 6,  
"other" : 0,  
"terms" : [ {  
"term" : "extérieur",  
"count" : 2  
}, {  
"term" : "autre",  
"count" : 2  
}, {  
"term" : "nouveau",  
"count" : 1  
}, {  
"term" : "intérieur",  
"count" : 1  
} ]  
}  
}  
}, {  
"took" : 3,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 10,  
"max\_score" : 0.0,  
"hits" : []  
}  
} ]  
}

Why do I get only text\_t1 facet (and not text\_t2)?  
Why is the hits total different?

Last question: Is it possible to pass the queries as url parameter for a multisearch (my client doesn't let me define bodies for GET requests)?

Thanks for your help.

Benoît

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![benq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benq/32/1428_2.png) [@benq](https://discuss.elastic.co/u/benq)\
**Post date:** [May 30, 2013, 9:16pm UTC](https://discuss.elastic.co/t/multisearch-questions-facets-and-query-string/12178/3 "2013-05-30T21:16:06Z")

</div>

Hi David,

As you pointed it, the problem was the empty line between the two requests.  
For those who want to use the multi search API, note that the request file  
must also end with an empty line.

Do you know if the multi search API can be used with query string as  
parameter, as described  
here [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/uri-request/) ?  
The documentation just says that not all search options are exposed,  
without saying which are not exposed.

Thanks for your help.

Benoît

Le jeudi 30 mai 2013 07:18:02 UTC+2, David Pilato a écrit :

> Is there an empty line between both requests?  
> It should not.
> 
> If you can reproduce it, can you create a full curl recreation, gist it  
> and open an issue?
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 29 mai 2013 à 23:49, benq \<[benoit....@gmail.com](mailto:benoit....@gmail.com) \<javascript:\>\> a  
> écrit :
> 
> Hi,
> 
> I do a multisearch with:  
> {}  
> {"query" : { "term" : {"category" : "sport"} }, "facets" : {"text\_t1" :  
> {"terms" : {"field" : "tags1", "size" : 20}}}}
> 
> {}  
> {"query" : { "term" : {"category" : "sport"} }, "facets" : {"text\_t2" :  
> {"terms" : {"field" : "tags1", "size" : 20}}}}
> 
> (twice the exact same request).
> 
> And, I get:  
> $ curl -XGET 'localhost:9200/\_msearch?search\_type=count&pretty=1'  
> --data-binary @requests; echo  
> {  
> "responses" : [ {  
> "took" : 3,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 5,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 6,  
> "max\_score" : 0.0,  
> "hits" :   
> },  
> "facets" : {  
> "text\_t1" : {  
> "\_type" : "terms",  
> "missing" : 0,  
> "total" : 6,  
> "other" : 0,  
> "terms" : [ {  
> "term" : "extérieur",  
> "count" : 2  
> }, {  
> "term" : "autre",  
> "count" : 2  
> }, {  
> "term" : "nouveau",  
> "count" : 1  
> }, {  
> "term" : "intérieur",  
> "count" : 1  
> } ]  
> }  
> }  
> }, {  
> "took" : 3,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 5,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 10,  
> "max\_score" : 0.0,  
> "hits" :   
> }  
> } ]  
> }
> 
> Why do I get only text\_t1 facet (and not text\_t2)?  
> Why is the hits total different?
> 
> Last question: Is it possible to pass the queries as url parameter for a  
> multisearch (my client doesn't let me define bodies for GET requests)?
> 
> Thanks for your help.
> 
> Benoît
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 5, 2013, 1:54pm UTC](https://discuss.elastic.co/t/multisearch-questions-facets-and-query-string/12178/4 "2013-06-05T13:54:55Z")

</div>

As far as I can see, only search\_type and ignore\_indices parameters are supported in \_msearch parameters.  
So q=\* does not work here.

So you should pass parameters using QueryDSL.

About documentation, I can read at the bottom of this page: [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/uri-request/) the full list of supported parameters for \_search end point.

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 30 mai 2013 à 23:16, benq [benoit.quartier@gmail.com](mailto:benoit.quartier@gmail.com) a écrit :

> Hi David,
> 
> As you pointed it, the problem was the empty line between the two requests.  
> For those who want to use the multi search API, note that the request file must also end with an empty line.
> 
> Do you know if the multi search API can be used with query string as parameter, as described here [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/uri-request/) ?  
> The documentation just says that not all search options are exposed, without saying which are not exposed.
> 
> Thanks for your help.
> 
> Benoît
> 
> Le jeudi 30 mai 2013 07:18:02 UTC+2, David Pilato a écrit :  
> Is there an empty line between both requests?  
> It should not.
> 
> If you can reproduce it, can you create a full curl recreation, gist it and open an issue?
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 29 mai 2013 à 23:49, benq [benoit....@gmail.com](mailto:benoit....@gmail.com) a écrit :
> 
> Hi,
> 
> I do a multisearch with:  
> {}  
> {"query" : { "term" : {"category" : "sport"} }, "facets" : {"text\_t1" : {"terms" : {"field" : "tags1", "size" : 20}}}}
> 
> {}  
> {"query" : { "term" : {"category" : "sport"} }, "facets" : {"text\_t2" : {"terms" : {"field" : "tags1", "size" : 20}}}}
> 
> (twice the exact same request).
> 
> And, I get:  
> $ curl -XGET 'localhost:9200/\_msearch?search\_type=count&pretty=1' --data-binary @requests; echo  
> {  
> "responses" : [ {  
> "took" : 3,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 5,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 6,  
> "max\_score" : 0.0,  
> "hits" :   
> },  
> "facets" : {  
> "text\_t1" : {  
> "\_type" : "terms",  
> "missing" : 0,  
> "total" : 6,  
> "other" : 0,  
> "terms" : [ {  
> "term" : "extérieur",  
> "count" : 2  
> }, {  
> "term" : "autre",  
> "count" : 2  
> }, {  
> "term" : "nouveau",  
> "count" : 1  
> }, {  
> "term" : "intérieur",  
> "count" : 1  
> } ]  
> }  
> }  
> }, {  
> "took" : 3,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 5,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 10,  
> "max\_score" : 0.0,  
> "hits" :   
> }  
> } ]  
> }
> 
> Why do I get only text\_t1 facet (and not text\_t2)?  
> Why is the hits total different?
> 
> Last question: Is it possible to pass the queries as url parameter for a multisearch (my client doesn't let me define bodies for GET requests)?
> 
> Thanks for your help.
> 
> Benoît
> 
> --  
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:32am UTC](https://discuss.elastic.co/t/multisearch-questions-facets-and-query-string/12178/5 "2017-07-06T02:32:47Z")

</div>


