featureValue must be a positive normal float, got: 0.0 for feature features.purchase_rank.rank_feature on field _feature which is less than the minimum positive normal float: 1.17549435E-38'
rank_feature
쿼리에서만 사용 가능positive_score_impact
: true 일 경우 높을 수록 boost (기본값) PUT my-index-000001
{
"mappings": {
"properties": {
"pagerank": {
"type": "rank_feature"
},
"url_length": {
"type": "rank_feature",
"positive_score_impact": false
}
}
}
}
PUT my-index-000001/_doc/1
{
"pagerank": 8,
"url_length": 22
}
GET my-index-000001/_search
{
"query": {
"rank_feature": {
"field": "pagerank"
}
}
}
rank_feature
타입과 유사하지만, 개별 필드를 지정하기엔 애매한 경우에 사용rank_feature
query 와 term
query 에 사용 가능term
query 에선 boost 에 rank_features
feature value 가 곱해진 값이 스코어링PUT my-index-000001
{
"mappings": {
"properties": {
"topics": {
"type": "rank_features"
},
"negative_reviews" : {
"type": "rank_features",
"positive_score_impact": false
}
}
}
}
PUT my-index-000001/_doc/1
{
"topics": {
"politics": 20,
"economics": 50.8
},
"negative_reviews": {
"1star": 10,
"2star": 100
}
}
PUT my-index-000001/_doc/2
{
"topics": {
"politics": 5.2,
"sports": 80.1
},
"negative_reviews": {
"1star": 1,
"2star": 10
}
}
GET my-index-000001/_search
{
"query": {
"rank_feature": {
"field": "topics.politics"
}
}
}
GET my-index-000001/_search
{
"query": {
"rank_feature": {
"field": "negative_reviews.1star"
}
}
}
rank_feature
, rank_features
필드의 숫자(numeric) 값을 통해 boost 하는
should
구문의 bool
쿼리에 들어가 relevance (관련성) score 에 사용하는 편
positive_score_impact
를 false 로 지정한 경우 해당 필드가 없는 document보다 필드값이 존재하는 document가 boost되기 때문에, 모든 document 에 해당 필드값을 지정하는 것이 좋음
track_total_hits
를 true 로 설정하였을 때, function_score
등 다른 relevance score 에 영향을 주는 쿼리보다 효율이 높다.
track_total_hits
는 쿼리에 매칭되는 hits 수를 추적하는 방법에 대한 설정true
이면 정확하게 추적false
로 설정rank_feature 계산용 함수로 Saturation
, Logarithm
, Sigmoid
, Linear
지원
PUT /test
{
"mappings": {
"properties": {
"pagerank": {
"type": "rank_feature"
},
"url_length": {
"type": "rank_feature",
"positive_score_impact": false
},
"topics": {
"type": "rank_features"
}
}
}
}
GET /test/_search
{
"query": {
"bool": {
"must": [
{
"match": {
"content": "2016"
}
}
],
"should": [
{
"rank_feature": {
"field": "pagerank"
}
},
{
"rank_feature": {
"field": "url_length",
"boost": 0.1
}
},
{
"rank_feature": {
"field": "topics.sports",
"boost": 0.4
}
}
]
}
}
}
S / (S + pivot)
pivot
값을 주지 않을 경우, index 에서 기하 평균(geometric mean) 근사치를 계산하여 사용S > pivot
이면 0.5 이상, S < pivot
이면 0.5 이하의 값이 됨GET /test/_search
{
"query": {
"rank_feature": {
"field": "pagerank",
"saturation": {
"pivot": 8
}
}
}
}
log(scaling_factor + S)
GET /test/_search
{
"query": {
"rank_feature": {
"field": "pagerank",
"log": {
"scaling_factor": 4
}
}
}
}
S^exp^ / (S^exp^ + pivot^exp^)
S
는 pivotexponent
는 0.5~1 사이의 양수GET /test/_search
{
"query": {
"rank_feature": {
"field": "pagerank",
"sigmoid": {
"pivot": 7,
"exponent": 0.6
}
}
}
}
S
rank_feature
필드값 그대로 계산"positive_score_impact": true
일 경우 S,"positive_score_impact": false
일 경우 1/S
GET /test/_search
{
"query": {
"rank_feature": {
"field": "pagerank",
"linear": {}
}
}
}