New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow _boost field to be indexed and stored in mapping #3752
Comments
has this feature been removed for 0.90.10? (I thought it might, since the _boost field is deprecated in 1.X). I have {
"_boost": {
"type": "float",
"index": "not_analyzed"
}
} in my mappings definition and, besides not getting any info on "_boost" field when I access _mapping entrypoint (which I guess is due to the _boost field being "special"), can't get ES to sort by it. |
Hi @JoeZ99 , the document boost wasn't removed for now, just deprecated in the documentation. |
there seems to be a bug or at least, unexpected behavior with this. here's how to reproduce it create an index with a _boost mapping POST http://localhost:9200/tito {
"mappings":{
"type1":{
"_boost": {"name": "df_boost", "null_value": 1.0, "index": "not_analyzed"},
"properties": {
"extra_field": {"type": "double"}
}
}
}
} an exception is raised in elasticsearch [2014-02-24 09:32:03,365][WARN ][indices.cluster ] [Master Khan] [tito] failed to add mapping [type1], source [{"type1":{"_boost":{"name":"df_boost","null_value":1.0,"index":true},"properties":{"extra_field":{"type":"double"}}}}]
org.elasticsearch.index.mapper.MapperParsingException: Wrong value for index [true] for field [df_boost]
at org.elasticsearch.index.mapper.core.TypeParsers.parseIndex(TypeParsers.java:194)
at org.elasticsearch.index.mapper.core.TypeParsers.parseField(TypeParsers.java:76)
at org.elasticsearch.index.mapper.core.TypeParsers.parseNumberField(TypeParsers.java:51)
at org.elasticsearch.index.mapper.internal.BoostFieldMapper$TypeParser.parse(BoostFieldMapper.java:99)
at org.elasticsearch.index.mapper.DocumentMapperParser.parse(DocumentMapperParser.java:235)
at org.elasticsearch.index.mapper.DocumentMapperParser.parseCompressed(DocumentMapperParser.java:183)
at org.elasticsearch.index.mapper.MapperService.parse(MapperService.java:322)
at org.elasticsearch.index.mapper.MapperService.merge(MapperService.java:200)
at org.elasticsearch.indices.cluster.IndicesClusterStateService.processMapping(IndicesClusterStateService.java:405)
at org.elasticsearch.indices.cluster.IndicesClusterStateService.applyMappings(IndicesClusterStateService.java:360)
at org.elasticsearch.indices.cluster.IndicesClusterStateService.clusterChanged(IndicesClusterStateService.java:179)
at org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:416)
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:135)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:679) the exception is about the However, the mapping is done GET http://localhost:9200/tito/_mapping {
"tito": {
"type1": {
"properties": {
"df_boost": {
"type": "long"
},
"field": {
"type": "string"
}
}
}
}
} and sorting by boost is possible! GET http://localhost:9200/tito/_search
{
"query": {"match_all": {} },
"sort": ['df_boost"]
} {
"took": 4,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": null,
"hits": [
{
"_index": "tito",
"_type": "type1",
"_id": "6r-8C64RSNuPQ1vGPENK6g",
"_score": null,
"_source": {
"field": "value",
"df_boost": 34
},
"sort": [
34
]
}
]
}
} this works whe accessing the REST API , but when using the THe issue/bug is that it throws an exception for no good reason. I'm using elasticasearch 0.9.10 |
The idea of the
_boost
field is that it provides an index time boost for all fields a document has, because of this the_boost
field isn't stored or indexed separately and only saved as part of the_source
.However the
_boost
field is also used to as just a sort field, but because it can't be indexed separately, this doesn't work. By allowing to make the_boost
indexable separately, sorting by the_boost
field does work. By default the_boost
field remains not indexed and not stored.This issue originates from PR #2913
The text was updated successfully, but these errors were encountered: