# Manipulate score by field integer value

**URL:** <https://discuss.elastic.co/t/manipulate-score-by-field-integer-value/313553>\
**Category:** Elasticsearch\
**Created:** [September 2, 2022, 12:21pm UTC](https://discuss.elastic.co/t/manipulate-score-by-field-integer-value/313553 "2022-09-02T12:21:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![frankmehlhop.com](https://avatars.discourse-cdn.com/v4/letter/f/97f17d/32.png) [@frankmehlhop.com](https://discuss.elastic.co/u/frankmehlhop.com)\
**Post date:** [September 2, 2022, 12:21pm UTC](https://discuss.elastic.co/t/manipulate-score-by-field-integer-value/313553/1 "2022-09-02T12:21:57Z")

</div>

I use Elastic for searching pdf's. One of the fields apart of the pdf-content is doridat, what is a date as integer. The newest documents should get a higher score (higher ranking). This means that the higher the value in the doridat field, the higher the score should be. Only the result from searching in attachment.content and doridat should influence the score.

**How can I force the scoring to integrate the field (doridat) value?**

My query:

```auto
GET /attachments/_search 
{  
  "size": 2,
  "from": 0,
  "query": {
    "query_string": {
      "query": "*satz*", 
      "fields": ["attachment.content", "doname^2"],
      "rewrite": "scoring_boolean"
    }
  },
  "highlight":{
    "fields":{
      "attachment.content":{}
    }
  },
  "_source": {
    "excludes": "attachment.content"
  }
}

```

My mapping:

```auto
{
  "attachments" : {
    "mappings" : {
      "properties" : {
        "attachment" : {
          "properties" : {
            "author" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "content" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "content_length" : {
              "type" : "long"
            },
            "content_type" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "creator_tool" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "date" : {
              "type" : "date"
            },
            "description" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "detect_language" : {
              "type" : "boolean"
            },
            "format" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "indexed_chars" : {
              "type" : "long"
            },
            "keywords" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "language" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "metadata_date" : {
              "type" : "date"
            },
            "modified" : {
              "type" : "date"
            },
            "name" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "title" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            }
          }
        },
        "content" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "daname" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "do__nr" : {
          "type" : "integer"
        },
        "do_typ" : {
          "type" : "integer"
        },
        "doext" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "doname" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "donr" : {
          "type" : "integer"
        },
        "doridat" : {
          "type" : "integer"
        },
        "dowww" : {
          "type" : "integer"
        },
        "id" : {
          "type" : "integer"
        },
        "path" : {
          "type" : "text",
          "analyzer" : "windows_path_hierarchy_analyzer"
        }
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 30, 2022, 12:22pm UTC](https://discuss.elastic.co/t/manipulate-score-by-field-integer-value/313553/2 "2022-09-30T12:22:25Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
