0

We use the new significant terms plugin in elasticsearch. Using the transport client I get less results compared to that when I use the REST API. I don't understand why. Using the node client is unfortunately not possible, since my service using ES is not in the same network. Why are the results different?

Here is the REST call:

POST /searchresults_sharded/article/_search 
{
  "query": {
    "match": {
      "titlebody": {
        "query": "japanische hundenamen",
        "operator": "and"
      }
    }
  },
  "aggregations": {
    "searchresults": {
      "significant_terms": {
        "field": "titlebody",
        "size": 100
      }
    }
  }
}

and here the scala request building code:

    val builder = reqBuilder.searchReqBuilder
    builder.setIndices(indexCoords.indexName)
    builder.setTypes(indexCoords.typeName)
    builder.setQuery(QueryBuilders.matchQuery(indexCoords.field, keywords.mkString(" ")).operator(MatchQueryBuilder.Operator.AND))
    val sigTermAggKey: String = "significant-term"
    val sigTermBuilder = new SignificantTermsBuilder(sigTermAggKey)
    sigTermBuilder.field(indexCoords.field)
    sigTermBuilder.size(size)
    builder.addAggregation(sigTermBuilder)
4

1 回答 1

0

我在 Builder 上使用了 toString 发现:原因是两个请求的大小参数不同。两个请求大小(20 和 100)都大于返回的 signif.term-aggregation 存储桶大小(7 与 1 相比),但查询大小参数似乎对返回的大小有影响,即使它远低于查询大小参数

于 2015-01-20T13:35:52.127 回答