London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

IClient.MultiSearch<T>

Vote:
 

Is multisearch applicable for free developer account?

I'm getting "Your key is not authorized to access (POST) '/_msearch'" error.

#82142
Mar 05, 2014 21:35
Vote:
 

Any comments?

#82326
Mar 11, 2014 8:10
Vote:
 

Does all other searches work?

#82330
Mar 11, 2014 9:13
Vote:
 

Could you share some more code what exactly goes wrong. Very hard to say just from that post.

#82331
Mar 11, 2014 9:22
Vote:
 

Yes, IClient.Search<T> calls works well.

#82332
Mar 11, 2014 9:24
Vote:
 
            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'"}

 

#82334
Edited, Mar 11, 2014 9:27
Vote:
 

Could you try to remove the .Take() ?

#82336
Mar 11, 2014 9:28
Vote:
 

Please check my post above for code and http request/response.

#82337
Mar 11, 2014 9:29
Vote:
 

Without .Take(0) that works fine!

 

But how can I omit hits? I need only to collect statistics (counts).

#82338
Edited, Mar 11, 2014 9:32
Vote:
 

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();

    

#82340
Mar 11, 2014 9:43
Vote:
 

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)

 

 

#82341
Mar 11, 2014 9:44
Vote:
 

Count might work fine but how do you do it when you have to get the counts for facets? Does take(1) works?

#82342
Mar 11, 2014 9:46
Vote:
 

Thank you, Marcus.

 

Looks like that is exactly what I need.

#82343
Mar 11, 2014 9:52
Vote:
 

Hi,

Update: the error was a bug and have been resolved in the backend.

Best Regards,
Henrik

#84405
Edited, Apr 01, 2014 16:10
Vote:
 

Thank you, Henrik!

#84415
Apr 01, 2014 17:54
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.