Could you share some more code what exactly goes wrong. Very hard to say just from that post.
Language language = Language.English;
var q = client.Search<ProductDocument>(language)
.For(query)
.InField(x => x.DisplayName[language.Name])
.Select(x => new SearchObject()
{
Id = x.Code
})
.Take(0);
IMultiSearch<SearchObject> multiSearch = client.MultiSearch<SearchObject>();
multiSearch.Searches.Add(q);
var r = multiSearch.GetResult();
Request:
POST http://es-api01.episerver.com/x7LhGJP29q351G068WmMdJNQIHVxtd4T/_msearch HTTP/1.1
Content-Type: application/json
User-Agent: EPiServer-Find-NET-API/7.5.446.1
Host: es-api01.episerver.com
Content-Length: 259
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
{"index":"yauheni_jula"}
{"size":0,"query":{"filtered":{"query":{"query_string":{"fields":["DisplayName.en$$string.en"],"query":"keyword"}},"filter":{"term":{"___types":"ProductDocument"}}}},"fields":["___types","Code$$string"]}
Response:
HTTP/1.1 403 Forbidden
X-Powered-By: Express
X-Request-Id: 71026873262599110
X-Request-Host: trufflerproxy201
Date: Tue, 11 Mar 2014 08:26:22 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 80
Connection: keep-alive
{"status":403,"error":"Your key is not authorized to access (POST) '/_msearch'"}
Without .Take(0) that works fine!
But how can I omit hits? I need only to collect statistics (counts).
You chould then use Count then if that is the only thing you are intrested in:
service.MultiSearch<Article>().Search<Article>(x => x.For("Banana").InField(y => y.Title)) .Search<Article>(x => x.For("Annanas").InField(y => y.Title))
.Count();
In general I want to build several queries to index, to collect statistic (count) without Unified search and run it in single call to the find service (for performance purposes)
Count might work fine but how do you do it when you have to get the counts for facets? Does take(1) works?
Hi,
Update: the error was a bug and have been resolved in the backend.
Best Regards,
Henrik
Is multisearch applicable for free developer account?
I'm getting "Your key is not authorized to access (POST) '/_msearch'" error.