I'm playing with the Multi Search API to get a response which contains a
bulk of counts search requests and i want set the search_type=count to
globally apply to all search requests.
I tried to set the search_type on the request header like that the below
but it does not work, it works only when i put it in the header of each
request in my bulk-request file (i mean that i had to duplicate that {"search_type"
: "count"} in each header )
curl -XGET http://localhost:9200/_msearch?pretty=1&search_type=count
--data-binary @bulk-request; echo
Any suggestions ??
--
Hi Ashraf
On Thu, 2013-01-03 at 05:21 -0800, Ashraf Sarhan wrote:
I'm playing with the Multi Search API to get a response which contains
a bulk of counts search requests and i want set the search_type=count
to globally apply to all search requests.
I tried to set the search_type on the request header like that the
below but it does not work, it works only when i put it in the header
of each request in my bulk-request file (i mean that i had to
duplicate that {"search_type" : "count"} in each header )
curl -XGET http://localhost:9200/_msearch?pretty=1&search_type=count
--data-binary @bulk-request; echo
You're probably missing the "search metadata" line before each query:
curl -XGET 'http://127.0.0.1:9200/test/test/_msearch?pretty=1&search_type=count' -d '
{}
{"query" : {"match_all" : {}}}
{}
{"query" : {"match_all" : {}}}
'
[Thu Jan 3 15:49:32 2013] Response:
{
"responses" : [
{
"hits" : {
"hits" : ,
"max_score" : 0,
"total" : 1
},
"timed_out" : false,
"_shards" : {
"failed" : 0,
"successful" : 5,
"total" : 5
},
"took" : 0
},
{
"hits" : {
"hits" : ,
"max_score" : 0,
"total" : 1
},
"timed_out" : false,
"_shards" : {
"failed" : 0,
"successful" : 5,
"total" : 5
},
"took" : 1
}
]
}
clint
--
1 Like
Big Thanks, Clinton It's working now.
On Thursday, January 3, 2013 4:50:46 PM UTC+2, Clinton Gormley wrote:
Hi Ashraf
On Thu, 2013-01-03 at 05:21 -0800, Ashraf Sarhan wrote:
I'm playing with the Multi Search API to get a response which contains
a bulk of counts search requests and i want set the search_type=count
to globally apply to all search requests.
I tried to set the search_type on the request header like that the
below but it does not work, it works only when i put it in the header
of each request in my bulk-request file (i mean that i had to
duplicate that {"search_type" : "count"} in each header )
curl -XGET http://localhost:9200/_msearch?pretty=1&search_type=count
--data-binary @bulk-request; echo
You're probably missing the "search metadata" line before each query:
curl -XGET '
http://127.0.0.1:9200/test/test/_msearch?pretty=1&search_type=count' -d
'
{}
{"query" : {"match_all" : {}}}
{}
{"query" : {"match_all" : {}}}
'
[Thu Jan 3 15:49:32 2013] Response:
{
"responses" : [
{
"hits" : {
"hits" : ,
"max_score" : 0,
"total" : 1
},
"timed_out" : false,
"_shards" : {
"failed" : 0,
"successful" : 5,
"total" : 5
},
"took" : 0
},
{
"hits" : {
"hits" : ,
"max_score" : 0,
"total" : 1
},
"timed_out" : false,
"_shards" : {
"failed" : 0,
"successful" : 5,
"total" : 5
},
"took" : 1
}
]
}
clint
--
Thanks a lot Clinton
Ashraf
On Thursday, January 3, 2013 4:50:46 PM UTC+2, Clinton Gormley wrote:
Hi Ashraf
On Thu, 2013-01-03 at 05:21 -0800, Ashraf Sarhan wrote:
I'm playing with the Multi Search API to get a response which contains
a bulk of counts search requests and i want set the search_type=count
to globally apply to all search requests.
I tried to set the search_type on the request header like that the
below but it does not work, it works only when i put it in the header
of each request in my bulk-request file (i mean that i had to
duplicate that {"search_type" : "count"} in each header )
curl -XGET http://localhost:9200/_msearch?pretty=1&search_type=count
--data-binary @bulk-request; echo
You're probably missing the "search metadata" line before each query:
curl -XGET '
http://127.0.0.1:9200/test/test/_msearch?pretty=1&search_type=count' -d
'
{}
{"query" : {"match_all" : {}}}
{}
{"query" : {"match_all" : {}}}
'
[Thu Jan 3 15:49:32 2013] Response:
{
"responses" : [
{
"hits" : {
"hits" : ,
"max_score" : 0,
"total" : 1
},
"timed_out" : false,
"_shards" : {
"failed" : 0,
"successful" : 5,
"total" : 5
},
"took" : 0
},
{
"hits" : {
"hits" : ,
"max_score" : 0,
"total" : 1
},
"timed_out" : false,
"_shards" : {
"failed" : 0,
"successful" : 5,
"total" : 5
},
"took" : 1
}
]
}
clint
--