Problem with json in multi-search request!

Hi all,

I try to use queries _msearch but I can't create a valid JSON!

this is what I try:
/_msearch

[
{
"query": {
"bool": {
"must": [
{
"term": {
"creatorId": 6
}
}
]
}
}
},
{
"query": {
"bool": {
"must": [
{
"term": {
"creatorId": 4
}
}
]
}
}
}
]

if you have a valid example json to _msearch, or that you know what is
wrong in my query. can you help me?

Thanks!
Camilo

--

of course this is a dummy example. :wink:

--

Hi,

Instead of trying to put all your queries in the same JSON, you need to put
them one after another, separated by a newline. And before each query, you
need to put another json with headers, such as index name, although you can
leave that header empty if you will. Take a look here for details:
http://www.elasticsearch.org/guide/reference/api/multi-search.html

An example could look like this:

$ cat request
{}
{ "query": { "bool": {"must": [{"term": {"creatorId": 6}}]}}}
{"index": "test_index"}
{"query": {"bool": {"must": [{"term": {"creatorId": 4}}]}}}
$ curl localhost:9200/_msearch?pretty=true --data-binary @request

Best regards,
Radu

http://sematext.com/ -- ElasticSearch -- Solr -- Lucene

On Mon, Nov 26, 2012 at 2:59 PM, Camilo Sierra camilo.sierrax@gmail.comwrote:

of course this is a dummy example. :wink:

--

--