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:
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:
{
"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"
}
}
}
}
}