Non-constant scoring

I'm doing a multi_match query on multi_fields and I'm expecting a constant
scoring because the search string is in all the documents. I'm running ES
1.3.4 with ICU plugin. Here are the steps to reproduce it:

index settings & mappings

PUT /blogs
{
"settings": {
"analysis": {
"filter": {
"length_filter": {
"type": "length",
"min": 2
}
},
"tokenizer": {
"nGram_tokenizer": {
"type": "nGram",
"min_gram": 2,
"max_gram": 30,
"token_chars": [ "letter", "digit", "symbol" ]
}
},
"analyzer": {
"nGram_analyzer": {
"type": "custom",
"filter": ["icu_normalizer", "icu_folding", "length_filter"],
"tokenizer": "nGram_tokenizer"
},
"search_analyzer": {
"type": "custom",
"filter": ["icu_normalizer", "icu_folding", "length_filter"],
"tokenizer": "icu_tokenizer"
},
"def_analyzer": {
"alias": ["icu_analyzer"],
"type": "custom",
"filter": ["icu_normalizer", "icu_folding"],
"tokenizer": "icu_tokenizer"
}
}
}
},
"mappings": {
"default": {
"_source": {
"enabled": true,
"compress": true,
"compress_threshold": "200b"
},
"_all": {
"enabled": true
},
"dynamic_date_formats": ["yyyy-MM-dd", "date_optional_time"]
},
"post": {
"dynamic": "strict",
"properties": {
"title": {
"type": "string",
"analyzer": "def_analyzer",
"fields": {
"ngram": {
"type": "string",
"analyzer": "nGram_analyzer",
"term_vector": "with_positions_offsets"
}
}
},
"content": {
"type": "string",
"analyzer": "def_analyzer",
"fields": {
"ngram": {
"type": "string",
"analyzer": "nGram_analyzer",
"term_vector": "with_positions_offsets"
}
}
},
"visible": {
"type": "boolean",
"index": "not_analyzed"
},
"post_date": {
"type": "date",
"index": "not_analyzed"
}
}
}
}
}

index some documents

PUT blogs/post/1
{
"title": "title 1",
"content": "",
"visible": true,
"post_date": "2014-11-03T12:50:00"
}

PUT blogs/post/2
{
"title": "title 2",
"content": "",
"visible": true,
"post_date": "2014-11-03T12:51:00"
}

PUT blogs/post/3
{
"title": "title 3",
"content": "",
"visible": true,
"post_date": "2014-11-03T12:52:00"
}

PUT blogs/post/4
{
"title": "title 4",
"content": "",
"visible": true,
"post_date": "2014-11-03T12:53:00"
}

PUT blogs/post/5
{
"title": "title 5",
"content": "",
"visible": true,
"post_date": "2014-11-03T12:54:00"
}

run the multi_match query and sort the results by score (desc) and

post_date (asc)
GET /blogs/post/_search
{
"query": {
"filtered": {
"query": {
"multi_match": {
"query": "tit",
"fields": ["title.ngram^2", "content.ngram"],
"type": "most_fields",
"operator": "and",
"analyzer": "search_analyzer",
"minimum_should_match" : 1
}
},
"filter": {
"term": { "visible": "true" }
}
}
},
"sort" : [
{ "_score": { "order": "desc" }},
{ "post_date": { "order": "asc" }}
]
}

{
"took": 4,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 5,
"max_score": null,
"hits": [
{
"_index": "blogs",
"_type": "post",
"_id": "1",
"_score": 0.025078464,
"_source": {
"title": "title 1",
"content": "",
"visible": true,
"post_date": "2014-11-03T12:50:00"
},
"sort": [
0.025078464,
1415019000000
]
},
{
"_index": "blogs",
"_type": "post",
"_id": "2",
"_score": 0.025078464,
"_source": {
"title": "title 2",
"content": "",
"visible": true,
"post_date": "2014-11-03T12:51:00"
},
"sort": [
0.025078464,
1415019060000
]
},
{
"_index": "blogs",
"_type": "post",
"_id": "3",
"_score": 0.025078464,
"_source": {
"title": "title 3",
"content": "",
"visible": true,
"post_date": "2014-11-03T12:52:00"
},
"sort": [
0.025078464,
1415019120000
]
},
{
"_index": "blogs",
"_type": "post",
"_id": "4",
"_score": 0.025078464,
"_source": {
"title": "title 4",
"content": "",
"visible": true,
"post_date": "2014-11-03T12:53:00"
},
"sort": [
0.025078464,
1415019180000
]
},
{
"_index": "blogs",
"_type": "post",
"_id": "5",
"_score": 0.025078464,
"_source": {
"title": "title 5",
"content": "",
"visible": true,
"post_date": "2014-11-03T12:54:00"
},
"sort": [
0.025078464,
1415019240000
]
}
]
}
}

As you see, the score is uniform (equal) as expected. Now if I add one more
document, the score changes:

index one more document

PUT blogs/post/6
{
"title": "title 6",
"content": "",
"visible": true,
"post_date": "2014-11-03T12:55:00"
}

{
"took": 4,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 6,
"max_score": null,
"hits": [
{
"_index": "blogs",
"_type": "post",
"_id": "1",
"_score": 0.053388856,
"_source": {
"title": "title 1",
"content": "",
"visible": true,
"post_date": "2014-11-03T12:50:00"
},
"sort": [
0.053388856,
1415019000000
]
},
{
"_index": "blogs",
"_type": "post",
"_id": "6",
"_score": 0.053388856,
"_source": {
"title": "title 6",
"content": "",
"visible": true,
"post_date": "2014-11-03T12:55:00"
},
"sort": [
0.053388856,
1415019300000
]
},
{
"_index": "blogs",
"_type": "post",
"_id": "2",
"_score": 0.025078464,
"_source": {
"title": "title 2",
"content": "",
"visible": true,
"post_date": "2014-11-03T12:51:00"
},
"sort": [
0.025078464,
1415019060000
]
},
{
"_index": "blogs",
"_type": "post",
"_id": "3",
"_score": 0.025078464,
"_source": {
"title": "title 3",
"content": "",
"visible": true,
"post_date": "2014-11-03T12:52:00"
},
"sort": [
0.025078464,
1415019120000
]
},
{
"_index": "blogs",
"_type": "post",
"_id": "4",
"_score": 0.025078464,
"_source": {
"title": "title 4",
"content": "",
"visible": true,
"post_date": "2014-11-03T12:53:00"
},
"sort": [
0.025078464,
1415019180000
]
},
{
"_index": "blogs",
"_type": "post",
"_id": "5",
"_score": 0.025078464,
"_source": {
"title": "title 5",
"content": "",
"visible": true,
"post_date": "2014-11-03T12:54:00"
},
"sort": [
0.025078464,
1415019240000
]
}
]
}
}

As you could see the score is not anymore constant.

Is this the expected behavior?

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/03f6a68d-6125-48cb-bed9-f7db87499c99%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.