# Can we perform multisearch with -d option?

**URL:** <https://discuss.elastic.co/t/can-we-perform-multisearch-with-d-option/9954>\
**Category:** Elasticsearch\
**Created:** [December 5, 2012, 3:24pm UTC](https://discuss.elastic.co/t/can-we-perform-multisearch-with-d-option/9954 "2012-12-05T15:24:45Z")\
**Posts on this page:** 4\
**Page:** 1

<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:** [December 5, 2012, 3:24pm UTC](https://discuss.elastic.co/t/can-we-perform-multisearch-with-d-option/9954/1 "2012-12-05T15:24:45Z")

</div>

Heya,

I'm working on Elasticsearch SPORE project and I'm wondering if we can perform a  
msearch query using -d.

I can do \_search with -d

$ curl -XPOST localhost:9200/\_search -d "{"query":{"match\_all":{}}}"  
{"took":168,"timed\_out":false,"\_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":0,"max\_score":null,"hits":[]}}

But I can't find a way to perform a \_msearch

$ curl -XPOST localhost:9200/\_msearch -d "{}{"query":{"match\_all":{}}}"  
{"error":"ActionRequestValidationException[Validation Failed: 1: no requests  
added;]","status":500}

I'm aware that in documentation, it's stated that we have to use --data-binary  
@filename form but I can't use that with spore. Is there any other way?  
Perhaps, I can work on a PR that allows to do it??? What do you think gurus? 😉

FYI, I tried this in SPORE (note the \n chars):

SporeResult result = spore.call("multi\_search", new  
ImmutableMap.Builder\<String, String\>()  
.put("index", \_index)  
.put("type", \_type)  
.build(),  
"{}\n{"query":{"match\_all":{}}}\n");

## Cheers

David Pilato  
[http://www.scrutmydocs.org/](http://www.scrutmydocs.org/)  
[http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

---

<div class="post-metadata">

**Author:** ![radu\_gheorghe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe/32/556_2.png) [@radu\_gheorghe](https://discuss.elastic.co/u/radu_gheorghe)\
**Post date:** [December 5, 2012, 4:23pm UTC](https://discuss.elastic.co/t/can-we-perform-multisearch-with-d-option/9954/2 "2012-12-05T16:23:08Z")

</div>

Hi David,

Not sure if this is what you're after, but the following works:  
curl -XPOST localhost:9200/\_msearch -d "{}  
{"query":{"match\_all":{}}}  
"

and this, too:

REQUEST=$'{}\n{"query":{"match\_all":{}}}\n'; curl -XPOST  
localhost:9200/\_msearch -d "$REQUEST"

## Best regards, Radu

[http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene

On Wed, Dec 5, 2012 at 5:24 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> \*\*  
> Heya,
> 
> I'm working on Elasticsearch SPORE project and I'm wondering if we can  
> perform a msearch query using -d.
> 
> I can do \_search with -d
> 
> $ curl -XPOST localhost:9200/\_search -d "{"query":{"match\_all":{}}}"
> 
> {"took":168,"timed\_out":false,"\_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":0,"max\_score":null,"hits":}}
> 
> But I can't find a way to perform a \_msearch
> 
> $ curl -XPOST localhost:9200/\_msearch -d "{}{"query":{"match\_all":{}}}"  
> {"error":"ActionRequestValidationException[Validation Failed: 1: no  
> requests added;]","status":500}
> 
> I'm aware that in documentation, it's stated that we have to use  
> --data-binary @filename form but I can't use that with spore. Is there any  
> other way?  
> Perhaps, I can work on a PR that allows to do it??? What do you think  
> gurus? 😉
> 
> FYI, I tried this in SPORE (note the \n chars):
> 
> SporeResult result = spore.call("multi\_search", new  
> ImmutableMap.Builder\<String, String\>()  
> .put("index", \_index)  
> .put("type", \_type)  
> .build(),  
> "{}\n{"query":{"match\_all":{}}}\n");
> 
> ## Cheers
> 
> David Pilato  
> [http://www.scrutmydocs.org/](http://www.scrutmydocs.org/)  
> [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> --

--

---

<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:** [December 5, 2012, 5:12pm UTC](https://discuss.elastic.co/t/can-we-perform-multisearch-with-d-option/9954/3 "2012-12-05T17:12:01Z")

</div>

Thanks Radu. It works...

That's strange. I think that there is an issue with the JSpore client.  
I have to check that.

Thanks again for your advices.  
David.

Le 5 décembre 2012 à 17:23, Radu Gheorghe [radu.gheorghe@sematext.com](mailto:radu.gheorghe@sematext.com) a écrit :

> Hi David,
> 
> Not sure if this is what you're after, but the following works:  
> curl -XPOST localhost:9200/\_msearch -d "{}  
> {"query":{"match\_all":{}}}  
> "
> 
> and this, too:
> 
> REQUEST=$'{}\n{"query":{"match\_all":{}}}\n'; curl -XPOST  
> localhost:9200/\_msearch -d "$REQUEST"
> 
> ## Best regards, Radu
> 
> [http://sematext.com/](http://sematext.com/) [http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr --  
> Lucene
> 
> On Wed, Dec 5, 2012 at 5:24 PM, David Pilato \<[david@pilato.fr](mailto:david@pilato.fr)  
> [mailto:david@pilato.fr](mailto:david@pilato.fr) \> wrote:
> 
> > > Heya,
> > 
> > I'm working on Elasticsearch SPORE project and I'm wondering if we can  
> > perform a msearch query using -d.
> > 
> > I can do \_search with -d
> > 
> > $ curl -XPOST localhost:9200/\_search -d "{"query":{"match\_all":{}}}"
> > 
> > {"took":168,"timed\_out":false,"\_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":0,"max\_score":null,"hits":}}
> > 
> > But I can't find a way to perform a \_msearch
> > 
> > $ curl -XPOST localhost:9200/\_msearch -d  
> > "{}{"query":{"match\_all":{}}}"  
> > {"error":"ActionRequestValidationException[Validation Failed: 1: no  
> > requests added;]","status":500}
> > 
> > I'm aware that in documentation, it's stated that we have to use  
> > --data-binary @filename form but I can't use that with spore. Is there any  
> > other way?  
> > Perhaps, I can work on a PR that allows to do it??? What do you think  
> > gurus? 😉
> > 
> > FYI, I tried this in SPORE (note the \n chars):
> > 
> > SporeResult result = spore.call("multi\_search", new  
> > ImmutableMap.Builder\<String, String\>()  
> > .put("index", \_index)  
> > .put("type", \_type)  
> > .build(),  
> > "{}\n{"query":{"match\_all":{}}}\n");
> > 
> > ## Cheers
> > 
> > David Pilato  
> > [http://www.scrutmydocs.org/](http://www.scrutmydocs.org/) [http://www.scrutmydocs.org/](http://www.scrutmydocs.org/)  
> > [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/) [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
> > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > 
> > --
> > 
> > >
> 
> --

--  
David Pilato  
[http://www.scrutmydocs.org/](http://www.scrutmydocs.org/)  
[http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

---

<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, 3:01am UTC](https://discuss.elastic.co/t/can-we-perform-multisearch-with-d-option/9954/4 "2017-07-06T03:01:13Z")

</div>


