# Consistent query score of path\_hierarchy tokenized field

**URL:** <https://discuss.elastic.co/t/consistent-query-score-of-path-hierarchy-tokenized-field/22396>\
**Category:** Elasticsearch\
**Created:** [February 26, 2015, 1:08am UTC](https://discuss.elastic.co/t/consistent-query-score-of-path-hierarchy-tokenized-field/22396 "2015-02-26T01:08:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ziggy](https://avatars.discourse-cdn.com/v4/letter/z/e79b87/32.png) [@ziggy](https://discuss.elastic.co/u/ziggy)\
**Post date:** [February 26, 2015, 1:08am UTC](https://discuss.elastic.co/t/consistent-query-score-of-path-hierarchy-tokenized-field/22396/1 "2015-02-26T01:08:38Z")

</div>

My goal is to be able to search [ns1.example.com](http://ns1.example.com) and get results for  
[ns1.example.com](http://ns1.example.com), [ns2.example.com](http://ns2.example.com), [subdomain.example.com](http://subdomain.example.com), and [example.com](http://example.com).

I indexed the field with a path\_hierarchy tokenizer with token order  
reversed and the lowercase token filter for the domain names.

I have tried to limit the matches with min\_score, and the \_score is not  
consistent from one search to another.

I think what I need a score based on the parts of the path that match. A  
query for [ns1.example.com](http://ns1.example.com) must score [ns1.example.com](http://ns1.example.com) as 3, [example.com](http://example.com) as  
2, [ns2.example.com](http://ns2.example.com) as 2, [example2.com](http://example2.com) as 1, etc.

My idea of how to achieve this goal is to use a match query and then  
rescore the search with a script.

--  
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/afde9f8b-587e-4bf2-98c9-dbf728475bdd%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/afde9f8b-587e-4bf2-98c9-dbf728475bdd%40googlegroups.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, 12:30am UTC](https://discuss.elastic.co/t/consistent-query-score-of-path-hierarchy-tokenized-field/22396/2 "2017-07-06T00:30:01Z")

</div>


