在弹性搜索中有相当于Solr RequestHandler吗? [英] Is there an equivalent of a Solr RequestHandler in Elasticsearch?

查看:113
本文介绍了在弹性搜索中有相当于Solr RequestHandler吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在评估我们是否可以将我们的Solr的后端移动到Elasticsearch。



然而,我似乎无法解决的是如果有一个等价的自定义请求处理程序的功能在Solr中配置(将在solrconfig.xml中配置)在Elasticsearch中。



对于上下文,在我们的Solr配置中,我们有一个数字静态定义的请求处理程序,具有一组预先配置的面,范围小面,小面枢轴。类似于下面的,在solrconfig.xml中配置的东西:

 < requestHandler name =/ fooclass =solr。 SearchHandler> 
< lst name =defaults>
< str name =fl>
field1,
field2
< / fl>
< str name =facet.field> bar< / str>
< str name ='facet.range'> range_facet< / str>
< str name ='f.range_facet.facet.range.start'> 0< / str>
< str name ='f.range_facet.facet.range.end'> 10< / str>
< str name ='f.range_facet.facet.range.gap'> 1< / str>
< / lst>
< / requestHandler>

然后我可以从RequestHandler直接获取一组文档,这样一个这样的 http:// solr-host:8983 / solr / collection-name / foo?q = *:*
并且Solr将返回只有所需字段和构面的文档集。基本上,执行查询的应用程序在查询时不需要知道(或配置为)请求所有返回的元素。



我的问题是 - 在Elasticsearch,是否有能力配置端点,只返回所需的聚合和/或字段,而不必在查询时将其发布到API?

解决方案

有一篇很好的文章, https://sematext.com/blog/2014/04/29/parametrizing-queries-in-solr-and-elasticsearch/ 。弹性搜索基本上使用模板代替处理程序来进行与搜索相关联的查询调用。还有多个可用的存储模板。请参阅此处的文档模板查询


I am currently assessing if we can move our Solr based backend to Elasticsearch.

However, something I can't seem to work out is if there is an equivalent capability of a custom request handler configure in Solr (as would be configured in the solrconfig.xml) in Elasticsearch.

For context, in our Solr configuration, we have a number of statically defined request handlers with a set of pre-configured facets, ranged facets, facet pivots. Something akin to the below, configured in solrconfig.xml:

<requestHandler name="/foo" class="solr.SearchHandler">
    <lst name="defaults">
        <str name="fl">
           field1,
           field2
        </fl>
        <str name="facet.field">bar</str>
        <str name='facet.range'>range_facet</str>
        <str name='f.range_facet.facet.range.start'>0</str>
        <str name='f.range_facet.facet.range.end'>10</str>
        <str name='f.range_facet.facet.range.gap'>1</str>
    </lst>
</requestHandler>

I could then GET a set of documents directly from that RequestHandler with something like this http://solr-host:8983/solr/collection-name/foo?q=*:* and Solr would return a document set with only the desired field and facets. Fundamentally, the application executing the query does not need to be aware of (or configured to) request all returned elements at the time of query.

My question is this - in Elasticsearch, is there an ability to configure an endpoint that would return only the desired aggregations and/or fields without having to post those to the API at the time of the query?

解决方案

There is a good article for this, https://sematext.com/blog/2014/04/29/parametrizing-queries-in-solr-and-elasticsearch/ . Elastic Search basically uses templates in place of handlers to make query calls associated with search .There are number of stored templates available for use too . See the documentation here Template Query

这篇关于在弹性搜索中有相当于Solr RequestHandler吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆