# Default field\_value\_factor query construction

**URL:** https://discuss.elastic.co/t/default-field-value-factor-query-construction/180820
**Category:** Elasticsearch
**Created:** [May 13, 2019, 1:15pm UTC](https://discuss.elastic.co/t/default-field-value-factor-query-construction/180820 "2019-05-13T13:15:51Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![roelg](https://avatars.discourse-cdn.com/v4/letter/r/9e8a1a/32.png) [@roelg](https://discuss.elastic.co/u/roelg)
#### Post date: [May 13, 2019, 1:15pm UTC](https://discuss.elastic.co/t/default-field-value-factor-query-construction/180820/1 "2019-05-13T13:15:51Z")

</div>

I have constructed a pretty default field\_value\_factor function\_score query in the java api (6.5):

```auto
return new FunctionScoreQueryBuilder.FilterFunctionBuilder(
                fieldValueFactorFunction("fieldname")
                .factor(1f)
                .missing(10.0)
                .modifier(FieldValueFactorFunction.Modifier.LOG)
        );

```

In the logs I checked the actual query that is constructed and I noticed it included a "match\_all" filter-query:

```auto
"functions":[  
        {  
          "filter":{  
            "match_all":{  
              "boost":1.0
            }
          },
          "field_value_factor":{  
            "field":"click_back",
            "factor":1.0,
            "missing":10.0,
            "modifier":"log"
          }
        }
      ]

```

Some questions:

1. Is this how a default field\_value\_factor is constructed anyway in elasticsearch, or is this default implementation part of the java api?
2. In terms of the "missing" parameter, what would be the difference between using the "missing" parameter and specifying a "filter" that checks if the field exists?
3. (dependent on previous question) If there is an exists-filter present; are the scores of the documents that don't have this field influenced in any way? or can I assume that these docs 'fall through' the filters without the score being modified?

---

<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: [June 10, 2019, 1:15pm UTC](https://discuss.elastic.co/t/default-field-value-factor-query-construction/180820/2 "2019-06-10T13:15:55Z")

</div>

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