Counting the results with setMinScore

Is it possible to count the results of similar documents indexed exceeding
a certain minimal score with more like this query?

Currently I am doing the following which is very inefficient:

public long getCount(MoreLikeThisQueryBuilder mltQueryBuilder, float
similarityAcceptance) {

    SearchResponse response = client.prepareSearch()

            .setQuery(mltQueryBuilder)

            .setMinScore(similarityAcceptance)

            .execute()

            .actionGet();

    return response.hits().totalHits();

}

and I would like something like the following:

public long getCount(MoreLikeThisQueryBuilder mltQueryBuilder, float
similarityAcceptance) {

    CountResponse response = client.prepareCount()

            .setQuery(mltQueryBuilder)

            .setMinScore(similarityAcceptance)

            .execute()

            .actionGet();

    return response.count();

}

Except that this second method does not take minimum score into
consideration, it counts all the documents, that is as if
similarityAcceptance = 0.0f.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

My friend told me that the functionality I would want is unsupported.

On Monday, 20 May 2013 17:03:13 UTC-7, Dávid Tóth wrote:

Is it possible to count the results of similar documents indexed exceeding
a certain minimal score with more like this query?

Currently I am doing the following which is very inefficient:

public long getCount(MoreLikeThisQueryBuilder mltQueryBuilder, float
similarityAcceptance) {

    SearchResponse response = client.prepareSearch()

            .setQuery(mltQueryBuilder)

            .setMinScore(similarityAcceptance)

            .execute()

            .actionGet();

    return response.hits().totalHits();

}

and I would like something like the following:

public long getCount(MoreLikeThisQueryBuilder mltQueryBuilder, float
similarityAcceptance) {

    CountResponse response = client.prepareCount()

            .setQuery(mltQueryBuilder)

            .setMinScore(similarityAcceptance)

            .execute()

            .actionGet();

    return response.count();

}

Except that this second method does not take minimum score into
consideration, it counts all the documents, that is as if
similarityAcceptance = 0.0f.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hmm, it should be possible using the search API. Set search_type=count
http://www.elasticsearch.org/guide/reference/api/search/search-type/ and
specify a min_score
http://www.elasticsearch.org/guide/reference/api/search/min-score.html

On 21 May 2013 18:54, Dávid Tóth 900102xy@gmail.com wrote:

My friend told me that the functionality I would want is unsupported.

On Monday, 20 May 2013 17:03:13 UTC-7, Dávid Tóth wrote:

Is it possible to count the results of similar documents indexed
exceeding a certain minimal score with more like this query?

Currently I am doing the following which is very inefficient:

public long getCount(**MoreLikeThisQueryBuilder mltQueryBuilder, float
similarityAcceptance) {

    SearchResponse response = client.prepareSearch()

            .setQuery(mltQueryBuilder)

            .setMinScore(**similarityAcceptance)

            .execute()

            .actionGet();

    return response.hits().totalHits();

}

and I would like something like the following:

public long getCount(**MoreLikeThisQueryBuilder mltQueryBuilder, float
similarityAcceptance) {

    CountResponse response = client.prepareCount()

            .setQuery(mltQueryBuilder)

            .setMinScore(**similarityAcceptance)

            .execute()

            .actionGet();

    return response.count();

}

Except that this second method does not take minimum score into
consideration, it counts all the documents, that is as if
similarityAcceptance = 0.0f.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.