Skip to content
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

martijnvg opened this Issue Sep 20, 2013 · 3 comments


None yet
3 participants
Copy link

martijnvg commented Sep 20, 2013

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


This comment has been minimized.

Copy link

JoeZ99 commented Feb 19, 2014

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.
Just want to know if it's removed. otherwise, I'll post this at the users group like a good kid. ;-)


This comment has been minimized.

Copy link

javanna commented Feb 19, 2014

Hi @JoeZ99 , the document boost wasn't removed for now, just deprecated in the documentation.


This comment has been minimized.

Copy link

JoeZ99 commented Feb 24, 2014

there seems to be a bug or at least, unexpected behavior with this.
more info at:

here's how to reproduce it

create an index with a _boost mapping

POST http://localhost:9200/tito
      "_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(
        at org.elasticsearch.index.mapper.core.TypeParsers.parseField(
        at org.elasticsearch.index.mapper.core.TypeParsers.parseNumberField(
        at org.elasticsearch.index.mapper.internal.BoostFieldMapper$TypeParser.parse(
        at org.elasticsearch.index.mapper.DocumentMapperParser.parse(
        at org.elasticsearch.index.mapper.DocumentMapperParser.parseCompressed(
        at org.elasticsearch.index.mapper.MapperService.parse(
        at org.elasticsearch.index.mapper.MapperService.merge(
        at org.elasticsearch.indices.cluster.IndicesClusterStateService.processMapping(
        at org.elasticsearch.indices.cluster.IndicesClusterStateService.applyMappings(
        at org.elasticsearch.indices.cluster.IndicesClusterStateService.clusterChanged(
        at org.elasticsearch.cluster.service.InternalClusterService$
        at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$
        at java.util.concurrent.ThreadPoolExecutor.runWorker(
        at java.util.concurrent.ThreadPoolExecutor$

the exception is about the "index": "not_analyzed" attribute of the "_boost" element.

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": [

this works whe accessing the REST API , but when using the pyes python client, the mapping never gets to a good ending.

THe issue/bug is that it throws an exception for no good reason.

I'm using elasticasearch 0.9.10

mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.