{"id":7820,"date":"2015-10-30T01:25:50","date_gmt":"2015-10-30T01:25:50","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2015\/10\/30\/how-to-set-elastica-suggest-from-specific-type-open-source-projects-ruflin-elastica\/"},"modified":"2015-10-30T01:25:50","modified_gmt":"2015-10-30T01:25:50","slug":"how-to-set-elastica-suggest-from-specific-type-open-source-projects-ruflin-elastica","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2015\/10\/30\/how-to-set-elastica-suggest-from-specific-type-open-source-projects-ruflin-elastica\/","title":{"rendered":"how to set Elastica suggest from specific type?-open source projects ruflin\/Elastica"},"content":{"rendered":"<p>I am faily new to elasticsearch and try to get along with elastica. I try to set suggester which suggest from a specific type. I have tried to used a method addType from \\Elastica\\Search, but it cann&#8217;t work.<\/p>\n<pre><code>$search = new \\Elastica\\Search($elasticaClient);\n$suggest = new \\Elastica\\Suggest\\Term();\n$suggest-&gt;addTerm('suggest', ['text' =&gt; $query, 'term' =&gt; ['field' =&gt; '_all']]);\n$search-&gt;addIndex($elasticaIndex);\n$search-&gt;addType($type);\n$search-&gt;addSuggest($suggest);\n$result = $search-&gt;search();\n<\/code><\/pre>\n<p>may can someone help me to resolve it? Thanks<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am faily new to elasticsearch and try to get along with elastica. I try to set suggester which suggest from a specific type. I have tried to used a method addType from \\Elastica\\Search, but it cann&#8217;t work. $search = new \\Elastica\\Search($elasticaClient); $suggest = new \\Elastica\\Suggest\\Term(); $suggest-&gt;addTerm(&#8216;suggest&#8217;, [&#8216;text&#8217; =&gt; $query, &#8216;term&#8217; =&gt; [&#8216;field&#8217; =&gt; &#8216;_all&#8217;]]); [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7820","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7820","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=7820"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7820\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7820"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7820"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7820"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}