# Issue (Bug?) with field\_value\_factor and Search Template

**URL:** <https://discuss.elastic.co/t/issue-bug-with-field-value-factor-and-search-template/19015>\
**Category:** Elasticsearch\
**Created:** [July 31, 2014, 9:52pm UTC](https://discuss.elastic.co/t/issue-bug-with-field-value-factor-and-search-template/19015 "2014-07-31T21:52:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![germap](https://avatars.discourse-cdn.com/v4/letter/g/4da419/32.png) [@germap](https://discuss.elastic.co/u/germap)\
**Post date:** [July 31, 2014, 9:52pm UTC](https://discuss.elastic.co/t/issue-bug-with-field-value-factor-and-search-template/19015/1 "2014-07-31T21:52:41Z")

</div>

Hi,

I'm getting the following error message while attempting to use the Search  
Template (I use ES 1.3.1):

_nested: ElasticsearchException[Unable to find a field mapper for field  
[weight]_

I' m storing the template in the .script index as stated here [1]. The  
field 'weight' is used inside a field\_value\_factor (function\_score).

The query runs appropriately when not using a Search Template.

You can find a mapping, sample data, working query, sample template, and a  
not working template query at [2].  
Is that a bug?

I'd appreciate any help,

Germán

* * *

[1] [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-template.html#\_filling\_in\_a\_query\_string\_with\_a\_single\_value](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-template.html#_filling_in_a_query_string_with_a_single_value)  
[2] [https://titanpad.com/es-fvf-issue](https://titanpad.com/es-fvf-issue)

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/65d2ceb8-37cb-4f61-92e6-e85c0c4f0b6e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/65d2ceb8-37cb-4f61-92e6-e85c0c4f0b6e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![germap](https://avatars.discourse-cdn.com/v4/letter/g/4da419/32.png) [@germap](https://discuss.elastic.co/u/germap)\
**Post date:** [August 1, 2014, 3:52pm UTC](https://discuss.elastic.co/t/issue-bug-with-field-value-factor-and-search-template/19015/2 "2014-08-01T15:52:06Z")

</div>

It seems I was taking too literally the Search Template documentation [1]  
(or perhaps it lacks a small note on search paths).

If I use what is stated in [1] I get the error I mentioned in the first  
post of this thread. Nonetheless, If I specify the full path in the POST  
query, ES returns what is expected.

i.e., POST \_search/template doesn't work, but POST  
/books/authors/\_search/template does.

Regards,

## Germán

[1]

> **[Elastic — The Search AI Company](https://www.elastic.co)**
>
> Power insights and outcomes with The Elastic Search AI Platform. See into your data and find answers that matter with enterprise solutions designed to help you accelerate time to insight. Try Elastic ...

2014-07-31 16:52 GMT-05:00 German Carrillo [carrillo.german@gmail.com](mailto:carrillo.german@gmail.com):

> Hi,
> 
> I'm getting the following error message while attempting to use the Search  
> Template (I use ES 1.3.1):
> 
> _nested: ElasticsearchException[Unable to find a field mapper for field  
> [weight]_
> 
> I' m storing the template in the .script index as stated here [1]. The  
> field 'weight' is used inside a field\_value\_factor (function\_score).
> 
> The query runs appropriately when not using a Search Template.
> 
> You can find a mapping, sample data, working query, sample template, and a  
> not working template query at [2].  
> Is that a bug?
> 
> I'd appreciate any help,
> 
> Germán
> 
> * * *
> 
> [1]  
> [Elastic — The Search AI Company | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-template.html#_filling_in_a_query_string_with_a_single_value)  
> [2] [https://titanpad.com/es-fvf-issue](https://titanpad.com/es-fvf-issue)
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/65d2ceb8-37cb-4f61-92e6-e85c0c4f0b6e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/65d2ceb8-37cb-4f61-92e6-e85c0c4f0b6e%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/65d2ceb8-37cb-4f61-92e6-e85c0c4f0b6e%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/65d2ceb8-37cb-4f61-92e6-e85c0c4f0b6e%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CANaz7mz6h7ipj%2BmwtPbPUGOkc5Q%2BWGHgiqOZZUksOMzBGXvWqA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CANaz7mz6h7ipj%2BmwtPbPUGOkc5Q%2BWGHgiqOZZUksOMzBGXvWqA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 1:11am UTC](https://discuss.elastic.co/t/issue-bug-with-field-value-factor-and-search-template/19015/3 "2017-07-06T01:11:38Z")

</div>


