# Incorrect offset/length values in phrase suggester result

**URL:** <https://discuss.elastic.co/t/incorrect-offset-length-values-in-phrase-suggester-result/18612>\
**Category:** Elasticsearch\
**Created:** [July 11, 2014, 7:25pm UTC](https://discuss.elastic.co/t/incorrect-offset-length-values-in-phrase-suggester-result/18612 "2014-07-11T19:25:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan\_Tanner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ryan_tanner/32/1059_2.png) [@Ryan\_Tanner](https://discuss.elastic.co/u/Ryan_Tanner)\
**Post date:** [July 11, 2014, 7:25pm UTC](https://discuss.elastic.co/t/incorrect-offset-length-values-in-phrase-suggester-result/18612/1 "2014-07-11T19:25:32Z")

</div>

I'm trying to use phrase suggesters against multiple fields. I thought I  
could just combine the results of each per-field suggestion but the offset  
and length values are all incorrect. The offset is always 0 and the length  
is always the length of the original string. This makes it impossible to  
combine the results.

Any idea what's wrong with this query that would cause that?

{  
"suggest": {  
"text": "consipre busines devlopment",  
"person\_name": {  
"phrase": {  
"field": "name.suggestion",  
"size": 1,  
"real\_word\_error\_likelihood": 0.95,  
"max\_errors": 0.5,  
"gram\_size": 2,  
"direct\_generator": [  
{  
"field": "name.suggestion",  
"suggest\_mode": "always",  
"min\_word\_length": 1  
}  
],  
"highlight": {  
"pre\_tag": "_",  
"post\_tag": "\</em\>"  
}  
}  
},  
"person\_organization": {  
"phrase": {  
"field": "organizations.suggestion",  
"size": 3,  
"real\_word\_error\_likelihood": 0.95,  
"max\_errors": 0.5,  
"gram\_size": 2,  
"direct\_generator": [  
{  
"field": "organizations.suggestion",  
"suggest\_mode": "always",  
"min\_word\_length": 1  
}  
],  
"highlight": {  
"pre\_tag": "",  
"post\_tag": "\</em\>"  
}  
}  
},  
"person\_role": {  
"phrase": {  
"field": "roles.suggestion",  
"size": 3,  
"real\_word\_error\_likelihood": 0.95,  
"max\_errors": 0.5,  
"gram\_size": 2,  
"direct\_generator": [  
{  
"field": "roles.suggestion",  
"suggest\_mode": "always",  
"min\_word\_length": 1  
}  
]  
}  
},  
"domain\_title\_suggestion": {  
"phrase": {  
"field": "domain\_title\_suggestion",  
"size": 1,  
"real\_word\_error\_likelihood": 0.95,  
"max\_errors": 0.5,  
"gram\_size": 2,  
"direct\_generator": [  
{  
"field": "domain\_title\_suggestion",  
"suggest\_mode": "always",  
"min\_word\_length": 1  
}  
],  
"highlight": {  
"pre\_tag": "",  
"post\_tag": "\</em\>"  
}  
}  
},  
"domain\_suggestion": {  
"phrase": {  
"field": "domain\_suggestion",  
"size": 1,  
"real\_word\_error\_likelihood": 0.95,  
"max\_errors": 0.5,  
"gram\_size": 2,  
"direct\_generator": [  
{  
"field": "domain\_suggestion",  
"suggest\_mode": "always",  
"min\_word\_length": 1  
}  
],  
"highlight": {  
"pre\_tag": "",  
"post\_tag": "\</em\>"  
}  
}  
}  
}  
}_

This is the result:

{  
"took": 99,  
"timed\_out": false,  
"\_shards": {  
"total": 1,  
"successful": 1,  
"failed": 0  
},  
"hits": {  
"total": 9,  
"max\_score": 1,  
"hits": [  
{  
"\_index": "conspire\_v3",  
"\_type": "network",  
"\_id": "1865",  
"\_score": 1,  
"\_source": {  
"network\_id": 12345,  
"name": "Battlestar Galactica",  
"connectedness": 0,  
"node\_type": "network",  
"node\_id": 1865  
}  
},  
{  
"\_index": "conspire\_v3",  
"\_type": "domain",  
"\_id": "1874",  
"\_score": 1,  
"\_source": {  
"count": 1,  
"domain": "[gmail.com](http://gmail.com)",  
"node\_type": "domain",  
"node\_id": 1874  
}  
},  
{  
"\_index": "conspire\_v3",  
"\_type": "domain",  
"\_id": "1871",  
"\_score": 1,  
"\_source": {  
"count": 1,  
"domain": "caprica.org",  
"node\_type": "domain",  
"node\_id": 1871  
}  
},  
{  
"\_index": "conspire\_v3",  
"\_type": "person",  
"\_id": "1876",  
"\_score": 1,  
"\_source": {  
"name": "Lee Adama",  
"connectedness": 0,  
"addresses": [  
"lee.adama@pegasus.org",  
"apollo@galactica.com"  
],  
"node\_type": "person",  
"node\_id": 1876,  
"domains": [  
"pegasus.org",  
"[galactica.com](http://galactica.com)"  
],  
"domain\_suggestion": [  
"pegasus.org",  
"[galactica.com](http://galactica.com)"  
]  
}  
},  
{  
"\_index": "conspire\_v3",  
"\_type": "domain",  
"\_id": "1879",  
"\_score": 1,  
"\_source": {  
"count": 1,  
"domain": "pegasus.org",  
"node\_type": "domain",  
"node\_id": 1879  
}  
},  
{  
"\_index": "conspire\_v3",  
"\_type": "person",  
"\_id": "1881",  
"\_score": 1,  
"\_source": {  
"name": "Bill Adama",  
"connectedness": 0,  
"addresses": [  
"bill.adama@pegasus.org",  
"william@galactica.com"  
],  
"node\_type": "person",  
"node\_id": 1881,  
"domains": [  
"pegasus.org",  
"[galactica.com](http://galactica.com)"  
],  
"domain\_suggestion": [  
"pegasus.org",  
"[galactica.com](http://galactica.com)"  
]  
}  
},  
{  
"\_index": "conspire\_v3",  
"\_type": "domain",  
"\_id": "1868",  
"\_score": 1,  
"\_source": {  
"count": 4,  
"domain": "[galactica.com](http://galactica.com)",  
"node\_type": "domain",  
"node\_id": 1868  
}  
},  
{  
"\_index": "conspire\_v3",  
"\_type": "person",  
"\_id": "1885",  
"\_score": 1,  
"\_source": {  
"name": "Felix Geta",  
"connectedness": 0,  
"addresses": [  
"geta@galactica.com"  
],  
"node\_type": "person",  
"node\_id": 1885,  
"domains": [  
"[galactica.com](http://galactica.com)"  
],  
"domain\_suggestion": [  
"[galactica.com](http://galactica.com)"  
]  
}  
},  
{  
"\_index": "conspire\_v3",  
"\_type": "person",  
"\_id": "1867",  
"\_score": 1,  
"\_source": {  
"name": "Kara Thrace",  
"connectedness": 1,  
"addresses": [  
"grumpygirl@gmail.com",  
"kara.thrace@caprica.org",  
"starbuck@galactica.com"  
],  
"node\_type": "person",  
"node\_id": 1867,  
"domains": [  
"[gmail.com](http://gmail.com)",  
"caprica.org",  
"[galactica.com](http://galactica.com)"  
],  
"domain\_suggestion": [  
"[galactica.com](http://galactica.com)"  
],  
"domain\_title\_suggestion": [  
"Battlestar Galactica"  
],  
"organizations": [  
"Conspire",  
"Fake Organization"  
],  
"roles": [  
"Business Development"  
]  
}  
}  
]  
},  
"suggest": {  
"domain\_title\_suggestion": [  
{  
"text": "consipre busines devlopment",  
"offset": 0,  
"length": 27,  
"options": [

```
    ]
  }
],
"person_name": [
  {
    "text": "consipre busines devlopment",
    "offset": 0,
    "length": 27,
    "options": [
      
    ]
  }
],
"person_organization": [
  {
    "text": "consipre busines devlopment",
    "offset": 0,
    "length": 27,
    "options": [
      {
        "text": "conspire busines devlopment",
        "highlighted": "<em>conspire<\/em> busines devlopment",
        "score": 0.13149868
      }
    ]
  }
],
"person_role": [
  {
    "text": "consipre busines devlopment",
    "offset": 0,
    "length": 27,
    "options": [
      {
        "text": "consipre business development",
        "score": 0.43433
      },
      {
        "text": "consipre busines development",
        "score": 0.22576733
      },
      {
        "text": "consipre business devlopment",
        "score": 0.22103381
      }
    ]
  }
],
"domain_suggestion": [
  {
    "text": "consipre busines devlopment",
    "offset": 0,
    "length": 27,
    "options": [
      
    ]
  }
]

```

}  
}

--  
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/c3527bed-da36-4123-8809-7d22800b10a7%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c3527bed-da36-4123-8809-7d22800b10a7%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ryan\_Tanner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ryan_tanner/32/1059_2.png) [@Ryan\_Tanner](https://discuss.elastic.co/u/Ryan_Tanner)\
**Post date:** [July 13, 2014, 7:39pm UTC](https://discuss.elastic.co/t/incorrect-offset-length-values-in-phrase-suggester-result/18612/2 "2014-07-13T19:39:35Z")

</div>

Hate to bump this but I'd really appreciate some advice on this issue.

On Friday, July 11, 2014 1:25:32 PM UTC-6, Ryan Tanner wrote:

> I'm trying to use phrase suggesters against multiple fields. I thought I  
> could just combine the results of each per-field suggestion but the offset  
> and length values are all incorrect. The offset is always 0 and the length  
> is always the length of the original string. This makes it impossible to  
> combine the results.
> 
> Any idea what's wrong with this query that would cause that?
> 
> {  
> "suggest": {  
> "text": "consipre busines devlopment",  
> "person\_name": {  
> "phrase": {  
> "field": "name.suggestion",  
> "size": 1,  
> "real\_word\_error\_likelihood": 0.95,  
> "max\_errors": 0.5,  
> "gram\_size": 2,  
> "direct\_generator": [  
> {  
> "field": "name.suggestion",  
> "suggest\_mode": "always",  
> "min\_word\_length": 1  
> }  
> ],  
> "highlight": {  
> "pre\_tag": "_",  
> "post\_tag": "\</em\>"  
> }  
> }  
> },  
> "person\_organization": {  
> "phrase": {  
> "field": "organizations.suggestion",  
> "size": 3,  
> "real\_word\_error\_likelihood": 0.95,  
> "max\_errors": 0.5,  
> "gram\_size": 2,  
> "direct\_generator": [  
> {  
> "field": "organizations.suggestion",  
> "suggest\_mode": "always",  
> "min\_word\_length": 1  
> }  
> ],  
> "highlight": {  
> "pre\_tag": "",  
> "post\_tag": "\</em\>"  
> }  
> }  
> },  
> "person\_role": {  
> "phrase": {  
> "field": "roles.suggestion",  
> "size": 3,  
> "real\_word\_error\_likelihood": 0.95,  
> "max\_errors": 0.5,  
> "gram\_size": 2,  
> "direct\_generator": [  
> {  
> "field": "roles.suggestion",  
> "suggest\_mode": "always",  
> "min\_word\_length": 1  
> }  
> ]  
> }  
> },  
> "domain\_title\_suggestion": {  
> "phrase": {  
> "field": "domain\_title\_suggestion",  
> "size": 1,  
> "real\_word\_error\_likelihood": 0.95,  
> "max\_errors": 0.5,  
> "gram\_size": 2,  
> "direct\_generator": [  
> {  
> "field": "domain\_title\_suggestion",  
> "suggest\_mode": "always",  
> "min\_word\_length": 1  
> }  
> ],  
> "highlight": {  
> "pre\_tag": "",  
> "post\_tag": "\</em\>"  
> }  
> }  
> },  
> "domain\_suggestion": {  
> "phrase": {  
> "field": "domain\_suggestion",  
> "size": 1,  
> "real\_word\_error\_likelihood": 0.95,  
> "max\_errors": 0.5,  
> "gram\_size": 2,  
> "direct\_generator": [  
> {  
> "field": "domain\_suggestion",  
> "suggest\_mode": "always",  
> "min\_word\_length": 1  
> }  
> ],  
> "highlight": {  
> "pre\_tag": "",  
> "post\_tag": "\</em\>"  
> }  
> }  
> }  
> }  
> }_
> 
>  
> 
> _This is the result:_
> 
>  
> 
> _{  
> "took": 99,  
> "timed\_out": false,  
> "\_shards": {  
> "total": 1,  
> "successful": 1,  
> "failed": 0  
> },  
> "hits": {  
> "total": 9,  
> "max\_score": 1,  
> "hits": [  
> {  
> "\_index": "conspire\_v3",  
> "\_type": "network",  
> "\_id": "1865",  
> "\_score": 1,  
> "\_source": {  
> "network\_id": 12345,  
> "name": "Battlestar Galactica",  
> "connectedness": 0,  
> "node\_type": "network",  
> "node\_id": 1865  
> }  
> },  
> {  
> "\_index": "conspire\_v3",  
> "\_type": "domain",  
> "\_id": "1874",  
> "\_score": 1,  
> "\_source": {  
> "count": 1,  
> "domain": "[gmail.com](http://gmail.com)",  
> "node\_type": "domain",  
> "node\_id": 1874  
> }  
> },  
> {  
> "\_index": "conspire\_v3",  
> "\_type": "domain",  
> "\_id": "1871",  
> "\_score": 1,  
> "\_source": {  
> "count": 1,  
> "domain": "[caprica.org](http://caprica.org)",  
> "node\_type": "domain",  
> "node\_id": 1871  
> }  
> },  
> {  
> "\_index": "conspire\_v3",  
> "\_type": "person",  
> "\_id": "1876",  
> "\_score": 1,  
> "\_source": {  
> "name": "Lee Adama",  
> "connectedness": 0,  
> "addresses": [  
> "[lee.adama@pegasus.org](mailto:lee.adama@pegasus.org)",  
> "[apollo@galactica.com](mailto:apollo@galactica.com)"  
> ],  
> "node\_type": "person",  
> "node\_id": 1876,  
> "domains": [  
> "[pegasus.org](http://pegasus.org)",  
> "[galactica.com](http://galactica.com)"  
> ],  
> "domain\_suggestion": [  
> "[pegasus.org](http://pegasus.org)",  
> "[galactica.com](http://galactica.com)"  
> ]  
> }  
> },  
> {  
> "\_index": "conspire\_v3",  
> "\_type": "domain",  
> "\_id": "1879",  
> "\_score": 1,  
> "\_source": {  
> "count": 1,  
> "domain": "[pegasus.org](http://pegasus.org)",  
> "node\_type": "domain",  
> "node\_id": 1879  
> }  
> },  
> {  
> "\_index": "conspire\_v3",  
> "\_type": "person",  
> "\_id": "1881",  
> "\_score": 1,  
> "\_source": {  
> "name": "Bill Adama",  
> "connectedness": 0,  
> "addresses": [  
> "[bill.adama@pegasus.org](mailto:bill.adama@pegasus.org)",  
> "[william@galactica.com](mailto:william@galactica.com)"  
> ],  
> "node\_type": "person",  
> "node\_id": 1881,  
> "domains": [  
> "[pegasus.org](http://pegasus.org)",  
> "[galactica.com](http://galactica.com)"  
> ],  
> "domain\_suggestion": [  
> "[pegasus.org](http://pegasus.org)",  
> "[galactica.com](http://galactica.com)"  
> ]  
> }  
> },  
> {  
> "\_index": "conspire\_v3",  
> "\_type": "domain",  
> "\_id": "1868",  
> "\_score": 1,  
> "\_source": {  
> "count": 4,  
> "domain": "[galactica.com](http://galactica.com)",  
> "node\_type": "domain",  
> "node\_id": 1868  
> }  
> },  
> {  
> "\_index": "conspire\_v3",  
> "\_type": "person",  
> "\_id": "1885",  
> "\_score": 1,  
> "\_source": {  
> "name": "Felix Geta",  
> "connectedness": 0,  
> "addresses": [  
> "[geta@galactica.com](mailto:geta@galactica.com)"  
> ],  
> "node\_type": "person",  
> "node\_id": 1885,  
> "domains": [  
> "[galactica.com](http://galactica.com)"  
> ],  
> "domain\_suggestion": [  
> "[galactica.com](http://galactica.com)"  
> ]  
> }  
> },  
> {  
> "\_index": "conspire\_v3",  
> "\_type": "person",  
> "\_id": "1867",  
> "\_score": 1,  
> "\_source": {  
> "name": "Kara Thrace",  
> "connectedness": 1,  
> "addresses": [  
> "[grumpygirl@gmail.com](mailto:grumpygirl@gmail.com)",  
> "[kara.thrace@caprica.org](mailto:kara.thrace@caprica.org)",  
> "[starbuck@galactica.com](mailto:starbuck@galactica.com)"  
> ],  
> "node\_type": "person",  
> "node\_id": 1867,  
> "domains": [  
> "[gmail.com](http://gmail.com)",  
> "[caprica.org](http://caprica.org)",  
> "[galactica.com](http://galactica.com)"  
> ],  
> "domain\_suggestion": [  
> "[galactica.com](http://galactica.com)"  
> ],  
> "domain\_title\_suggestion": [  
> "Battlestar Galactica"  
> ],  
> "organizations": [  
> "Conspire",  
> "Fake Organization"  
> ],  
> "roles": [  
> "Business Development"  
> ]  
> }  
> }  
> ]  
> },  
> "suggest": {  
> "domain\_title\_suggestion": [  
> {  
> "text": "consipre busines devlopment",  
> "offset": 0,  
> "length": 27,  
> "options": [_
> 
>  
> 
> _```
> ]
> }
> ],
> "person_name": [
> {
> "text": "consipre busines devlopment",
> "offset": 0,
> "length": 27,
> "options": [_
>       
> _]
> }
> ],
> "person_organization": [
> {
> "text": "consipre busines devlopment",
> "offset": 0,
> "length": 27,
> "options": [
> {
> "text": "conspire busines devlopment",
> "highlighted": "<em>conspire<\/em> busines devlopment",
> "score": 0.13149868
> }
> ]
> }
> ],
> "person_role": [
> {
> "text": "consipre busines devlopment",
> "offset": 0,
> "length": 27,
> "options": [
> {
> "text": "consipre business development",
> "score": 0.43433
> },
> {
> "text": "consipre busines development",
> "score": 0.22576733
> },
> {
> "text": "consipre business devlopment",
> "score": 0.22103381
> }
> ]
> }
> ],
> "domain_suggestion": [
> {
> "text": "consipre busines devlopment",
> "offset": 0,
> "length": 27,
> "options": [_
>       
> _]
> }
> ]_
> 
> _```_
> 
>  
> 
> _}  
> }_

 

_--  
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/d1a0b568-2f67-4b3b-a2df-95447d08efed%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d1a0b568-2f67-4b3b-a2df-95447d08efed%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout)._

---

<div class="post-metadata">

**Author:** ![Itamar\_Syn\_Hershko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/itamar_syn_hershko/32/725_2.png) [@Itamar\_Syn\_Hershko](https://discuss.elastic.co/u/Itamar_Syn_Hershko)\
**Post date:** [July 13, 2014, 10:23pm UTC](https://discuss.elastic.co/t/incorrect-offset-length-values-in-phrase-suggester-result/18612/3 "2014-07-13T22:23:18Z")

</div>

This looks like a bug, so you should probably create a repro and open a  
github ticket for that. Before doing this tho I'd try to test with the  
latest ES version, and also make sure there aren't custom analyzers / token  
filters involved

--

Itamar Syn-Hershko  
[http://code972.com](http://code972.com) | @synhershko [https://twitter.com/synhershko](https://twitter.com/synhershko)  
Freelance Developer & Consultant  
Author of RavenDB in Action [http://manning.com/synhershko/](http://manning.com/synhershko/)

On Sun, Jul 13, 2014 at 10:39 PM, Ryan Tanner [ryan.tanner@gmail.com](mailto:ryan.tanner@gmail.com) wrote:

> Hate to bump this but I'd really appreciate some advice on this issue.
> 
> On Friday, July 11, 2014 1:25:32 PM UTC-6, Ryan Tanner wrote:
> 
> > I'm trying to use phrase suggesters against multiple fields. I thought I  
> > could just combine the results of each per-field suggestion but the offset  
> > and length values are all incorrect. The offset is always 0 and the length  
> > is always the length of the original string. This makes it impossible to  
> > combine the results.
> > 
> > Any idea what's wrong with this query that would cause that?
> > 
> > {  
> > "suggest": {  
> > "text": "consipre busines devlopment",  
> > "person\_name": {  
> > "phrase": {  
> > "field": "name.suggestion",  
> > "size": 1,  
> > "real\_word\_error\_likelihood": 0.95,  
> > "max\_errors": 0.5,  
> > "gram\_size": 2,  
> > "direct\_generator": [  
> > {  
> > "field": "name.suggestion",  
> > "suggest\_mode": "always",  
> > "min\_word\_length": 1  
> > }  
> > ],  
> > "highlight": {  
> > "pre\_tag": "_",  
> > "post\_tag": "\</em\>"  
> > }  
> > }  
> > },  
> > "person\_organization": {  
> > "phrase": {  
> > "field": "organizations.suggestion",  
> > "size": 3,  
> > "real\_word\_error\_likelihood": 0.95,  
> > "max\_errors": 0.5,  
> > "gram\_size": 2,  
> > "direct\_generator": [  
> > {  
> > "field": "organizations.suggestion",  
> > "suggest\_mode": "always",  
> > "min\_word\_length": 1  
> > }  
> > ],  
> > "highlight": {  
> > "pre\_tag": "",  
> > "post\_tag": "\</em\>"  
> > }  
> > }  
> > },  
> > "person\_role": {  
> > "phrase": {  
> > "field": "roles.suggestion",  
> > "size": 3,  
> > "real\_word\_error\_likelihood": 0.95,  
> > "max\_errors": 0.5,  
> > "gram\_size": 2,  
> > "direct\_generator": [  
> > {  
> > "field": "roles.suggestion",  
> > "suggest\_mode": "always",  
> > "min\_word\_length": 1  
> > }  
> > ]  
> > }  
> > },  
> > "domain\_title\_suggestion": {  
> > "phrase": {  
> > "field": "domain\_title\_suggestion",  
> > "size": 1,  
> > "real\_word\_error\_likelihood": 0.95,  
> > "max\_errors": 0.5,  
> > "gram\_size": 2,  
> > "direct\_generator": [  
> > {  
> > "field": "domain\_title\_suggestion",  
> > "suggest\_mode": "always",  
> > "min\_word\_length": 1  
> > }  
> > ],  
> > "highlight": {  
> > "pre\_tag": "",  
> > "post\_tag": "\</em\>"  
> > }  
> > }  
> > },  
> > "domain\_suggestion": {  
> > "phrase": {  
> > "field": "domain\_suggestion",  
> > "size": 1,  
> > "real\_word\_error\_likelihood": 0.95,  
> > "max\_errors": 0.5,  
> > "gram\_size": 2,  
> > "direct\_generator": [  
> > {  
> > "field": "domain\_suggestion",  
> > "suggest\_mode": "always",  
> > "min\_word\_length": 1  
> > }  
> > ],  
> > "highlight": {  
> > "pre\_tag": "",  
> > "post\_tag": "\</em\>"  
> > }  
> > }  
> > }  
> > }  
> > }_
> > 
> >  
> > 
> > _This is the result:_
> > 
> >  
> > 
> > _{  
> > "took": 99,  
> > "timed\_out": false,  
> > "\_shards": {  
> > "total": 1,  
> > "successful": 1,  
> > "failed": 0  
> > },  
> > "hits": {  
> > "total": 9,  
> > "max\_score": 1,  
> > "hits": [  
> > {  
> > "\_index": "conspire\_v3",  
> > "\_type": "network",  
> > "\_id": "1865",  
> > "\_score": 1,  
> > "\_source": {  
> > "network\_id": 12345,  
> > "name": "Battlestar Galactica",  
> > "connectedness": 0,  
> > "node\_type": "network",  
> > "node\_id": 1865  
> > }  
> > },  
> > {  
> > "\_index": "conspire\_v3",  
> > "\_type": "domain",  
> > "\_id": "1874",  
> > "\_score": 1,  
> > "\_source": {  
> > "count": 1,  
> > "domain": "[gmail.com](http://gmail.com)",  
> > "node\_type": "domain",  
> > "node\_id": 1874  
> > }  
> > },  
> > {  
> > "\_index": "conspire\_v3",  
> > "\_type": "domain",  
> > "\_id": "1871",  
> > "\_score": 1,  
> > "\_source": {  
> > "count": 1,  
> > "domain": "[caprica.org](http://caprica.org)",  
> > "node\_type": "domain",  
> > "node\_id": 1871  
> > }  
> > },  
> > {  
> > "\_index": "conspire\_v3",  
> > "\_type": "person",  
> > "\_id": "1876",  
> > "\_score": 1,  
> > "\_source": {  
> > "name": "Lee Adama",  
> > "connectedness": 0,  
> > "addresses": [  
> > "[lee.adama@pegasus.org](mailto:lee.adama@pegasus.org)",  
> > "[apollo@galactica.com](mailto:apollo@galactica.com)"  
> > ],  
> > "node\_type": "person",  
> > "node\_id": 1876,  
> > "domains": [  
> > "[pegasus.org](http://pegasus.org)",  
> > "[galactica.com](http://galactica.com)"  
> > ],  
> > "domain\_suggestion": [  
> > "[pegasus.org](http://pegasus.org)",  
> > "[galactica.com](http://galactica.com)"  
> > ]  
> > }  
> > },  
> > {  
> > "\_index": "conspire\_v3",  
> > "\_type": "domain",  
> > "\_id": "1879",  
> > "\_score": 1,  
> > "\_source": {  
> > "count": 1,  
> > "domain": "[pegasus.org](http://pegasus.org)",  
> > "node\_type": "domain",  
> > "node\_id": 1879  
> > }  
> > },  
> > {  
> > "\_index": "conspire\_v3",  
> > "\_type": "person",  
> > "\_id": "1881",  
> > "\_score": 1,  
> > "\_source": {  
> > "name": "Bill Adama",  
> > "connectedness": 0,  
> > "addresses": [  
> > "[bill.adama@pegasus.org](mailto:bill.adama@pegasus.org)",  
> > "[william@galactica.com](mailto:william@galactica.com)"  
> > ],  
> > "node\_type": "person",  
> > "node\_id": 1881,  
> > "domains": [  
> > "[pegasus.org](http://pegasus.org)",  
> > "[galactica.com](http://galactica.com)"  
> > ],  
> > "domain\_suggestion": [  
> > "[pegasus.org](http://pegasus.org)",  
> > "[galactica.com](http://galactica.com)"  
> > ]  
> > }  
> > },  
> > {  
> > "\_index": "conspire\_v3",  
> > "\_type": "domain",  
> > "\_id": "1868",  
> > "\_score": 1,  
> > "\_source": {  
> > "count": 4,  
> > "domain": "[galactica.com](http://galactica.com)",  
> > "node\_type": "domain",  
> > "node\_id": 1868  
> > }  
> > },  
> > {  
> > "\_index": "conspire\_v3",  
> > "\_type": "person",  
> > "\_id": "1885",  
> > "\_score": 1,  
> > "\_source": {  
> > "name": "Felix Geta",  
> > "connectedness": 0,  
> > "addresses": [  
> > "[geta@galactica.com](mailto:geta@galactica.com)"  
> > ],  
> > "node\_type": "person",  
> > "node\_id": 1885,  
> > "domains": [  
> > "[galactica.com](http://galactica.com)"  
> > ],  
> > "domain\_suggestion": [  
> > "[galactica.com](http://galactica.com)"  
> > ]  
> > }  
> > },  
> > {  
> > "\_index": "conspire\_v3",  
> > "\_type": "person",  
> > "\_id": "1867",  
> > "\_score": 1,  
> > "\_source": {  
> > "name": "Kara Thrace",  
> > "connectedness": 1,  
> > "addresses": [  
> > "[grumpygirl@gmail.com](mailto:grumpygirl@gmail.com)",  
> > "[kara.thrace@caprica.org](mailto:kara.thrace@caprica.org)",  
> > "[starbuck@galactica.com](mailto:starbuck@galactica.com)"  
> > ],  
> > "node\_type": "person",  
> > "node\_id": 1867,  
> > "domains": [  
> > "[gmail.com](http://gmail.com)",  
> > "[caprica.org](http://caprica.org)",  
> > "[galactica.com](http://galactica.com)"  
> > ],  
> > "domain\_suggestion": [  
> > "[galactica.com](http://galactica.com)"  
> > ],  
> > "domain\_title\_suggestion": [  
> > "Battlestar Galactica"  
> > ],  
> > "organizations": [  
> > "Conspire",  
> > "Fake Organization"  
> > ],  
> > "roles": [  
> > "Business Development"  
> > ]  
> > }  
> > }  
> > ]  
> > },  
> > "suggest": {  
> > "domain\_title\_suggestion": [  
> > {  
> > "text": "consipre busines devlopment",  
> > "offset": 0,  
> > "length": 27,  
> > "options": [_
> > 
> >  
> > 
> > _```
> > ]
> > }
> > ],
> > "person_name": [
> > {
> > "text": "consipre busines devlopment",
> > "offset": 0,
> > "length": 27,
> > "options": [_
> > 
> > _]
> > }
> > ],
> > "person_organization": [
> > {
> > "text": "consipre busines devlopment",
> > "offset": 0,
> > "length": 27,
> > "options": [
> > {
> > "text": "conspire busines devlopment",
> > "highlighted": "<em>conspire<\/em> busines devlopment",
> > "score": 0.13149868
> > }
> > ]
> > }
> > ],
> > "person_role": [
> > {
> > "text": "consipre busines devlopment",
> > "offset": 0,
> > "length": 27,
> > "options": [
> > {
> > "text": "consipre business development",
> > "score": 0.43433
> > },
> > {
> > "text": "consipre busines development",
> > "score": 0.22576733
> > },
> > {_
> > 
> > _"text": "consipre business devlopment",
> > "score": 0.22103381
> > }
> > ]
> > }
> > ],
> > "domain_suggestion": [_
> > 
> > _{
> > "text": "consipre busines devlopment",
> > "offset": 0,
> > "length": 27,
> > "options": [_
> > 
> > _]
> > }
> > ]_
> > 
> > _```_
> > 
> >  
> > 
> > _}  
> > }_
> > 
> >  
> > 
> > _--  
> > 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/d1a0b568-2f67-4b3b-a2df-95447d08efed%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d1a0b568-2f67-4b3b-a2df-95447d08efed%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/d1a0b568-2f67-4b3b-a2df-95447d08efed%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/d1a0b568-2f67-4b3b-a2df-95447d08efed%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/CAHTr4Zt%3Ds1C%3DjdyL4Q%3DBiP03hV1Z%2BfwchkTGEhnutZjF\_K5Mfg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHTr4Zt%3Ds1C%3DjdyL4Q%3DBiP03hV1Z%2BfwchkTGEhnutZjF_K5Mfg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout)._

---

<div class="post-metadata">

**Author:** ![Ryan\_Tanner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ryan_tanner/32/1059_2.png) [@Ryan\_Tanner](https://discuss.elastic.co/u/Ryan_Tanner)\
**Post date:** [July 14, 2014, 5:10am UTC](https://discuss.elastic.co/t/incorrect-offset-length-values-in-phrase-suggester-result/18612/4 "2014-07-14T05:10:08Z")

</div>

I have the same result on both 1.1.1 and 1.2.2. All the index-time  
analyzers on these fields are identical:

```
"index.analysis.filter.shingle_filter.type" : "shingle",
"index.analysis.filter.shingle_filter.min_shingle_size" : 2,
"index.analysis.filter.shingle_filter.max_shingle_size" : 5,
"index.analysis.analyzer.shingle_analyzer.type" : "custom",
"index.analysis.analyzer.shingle_analyzer.tokenizer" : "standard",
"index.analysis.analyzer.shingle_analyzer.filter" : [ "lowercase", 

```

"shingle\_filter" ]

On Sunday, July 13, 2014 4:23:33 PM UTC-6, Itamar Syn-Hershko wrote:

> This looks like a bug, so you should probably create a repro and open a  
> github ticket for that. Before doing this tho I'd try to test with the  
> latest ES version, and also make sure there aren't custom analyzers / token  
> filters involved
> 
> --
> 
> Itamar Syn-Hershko  
> [http://code972.com](http://code972.com) | @synhershko [https://twitter.com/synhershko](https://twitter.com/synhershko)  
> Freelance Developer & Consultant  
> Author of RavenDB in Action [http://manning.com/synhershko/](http://manning.com/synhershko/)
> 
> On Sun, Jul 13, 2014 at 10:39 PM, Ryan Tanner \<[ryan....@gmail.com](mailto:ryan....@gmail.com)  
> \<javascript:\>\> wrote:
> 
> Hate to bump this but I'd really appreciate some advice on this issue.
> 
> On Friday, July 11, 2014 1:25:32 PM UTC-6, Ryan Tanner wrote:
> 
> I'm trying to use phrase suggesters against multiple fields. I thought I  
> could just combine the results of each per-field suggestion but the offset  
> and length values are all incorrect. The offset is always 0 and the length  
> is always the length of the original string. This makes it impossible to  
> combine the results.
> 
> Any idea what's wrong with this query that would cause that?

--  
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/07b6b933-3bfd-4d44-917e-afe5299c544f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/07b6b933-3bfd-4d44-917e-afe5299c544f%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ryan\_Tanner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ryan_tanner/32/1059_2.png) [@Ryan\_Tanner](https://discuss.elastic.co/u/Ryan_Tanner)\
**Post date:** [July 14, 2014, 8:55pm UTC](https://discuss.elastic.co/t/incorrect-offset-length-values-in-phrase-suggester-result/18612/5 "2014-07-14T20:55:05Z")

</div>

I must be doing something silly.

Looking at the documents returned within the suggestion result (responses \   
hits \ hits), there's absolutely no correlation between those documents and  
the query. And for some reason it just returns documents that are all  
associated with domain names from South Africa, which really makes no sense  
within the context of our use case.

For instance, the text "davis cohen" returns documents like:

```
    "_index": "conspire_v3",
    "_type": "person",
    "_id": "5544649",
    "_score": 1,
    "_source": {
      "name": " **name redacted** ( **hidden** @absa.co.za)",
      "connectedness": 0,
      "addresses": [
        " **hidden** @absa.co.za"
      ],
      "node_type": "person",
      "node_id": 5544649,
      "domains": [
        "absa.co.za"
      ],
      "last_nickname_analysis": "20140708T225812.918+0000",
      "last_neo_upgrade": "20140708T231707.160+0000",
      "last_suggestion_crawl": "20140712T155002.491+0000",
      "domain_suggestion": [
        "absa.co.za"
      ]
    }

```

(the redacted name appears to be dutch in origin and is no where even close  
to the original search phrase.

We're not using the combo query/suggester option, this is a standalone  
suggestion. Is there supposed to be any significance to the documents  
included in the response?

On Sunday, July 13, 2014 11:10:08 PM UTC-6, Ryan Tanner wrote:

> I have the same result on both 1.1.1 and 1.2.2. All the index-time  
> analyzers on these fields are identical:
> 
> ```
> "index.analysis.filter.shingle_filter.type" : "shingle",
> "index.analysis.filter.shingle_filter.min_shingle_size" : 2,
> "index.analysis.filter.shingle_filter.max_shingle_size" : 5,
> "index.analysis.analyzer.shingle_analyzer.type" : "custom",
> "index.analysis.analyzer.shingle_analyzer.tokenizer" : "standard",
> "index.analysis.analyzer.shingle_analyzer.filter" : [ "lowercase", 
> 
> ```
> 
> "shingle\_filter" ]
> 
> On Sunday, July 13, 2014 4:23:33 PM UTC-6, Itamar Syn-Hershko wrote:
> 
> > This looks like a bug, so you should probably create a repro and open a  
> > github ticket for that. Before doing this tho I'd try to test with the  
> > latest ES version, and also make sure there aren't custom analyzers / token  
> > filters involved
> > 
> > --
> > 
> > Itamar Syn-Hershko  
> > [http://code972.com](http://code972.com) | @synhershko [https://twitter.com/synhershko](https://twitter.com/synhershko)  
> > Freelance Developer & Consultant  
> > Author of RavenDB in Action [http://manning.com/synhershko/](http://manning.com/synhershko/)
> > 
> > On Sun, Jul 13, 2014 at 10:39 PM, Ryan Tanner [ryan....@gmail.com](mailto:ryan....@gmail.com) wrote:
> > 
> > Hate to bump this but I'd really appreciate some advice on this issue.
> > 
> > On Friday, July 11, 2014 1:25:32 PM UTC-6, Ryan Tanner wrote:
> > 
> > I'm trying to use phrase suggesters against multiple fields. I thought I  
> > could just combine the results of each per-field suggestion but the offset  
> > and length values are all incorrect. The offset is always 0 and the length  
> > is always the length of the original string. This makes it impossible to  
> > combine the results.
> > 
> > Any idea what's wrong with this query that would cause that?

--  
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/78fdf537-91b3-4246-89da-1c82463affcf%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/78fdf537-91b3-4246-89da-1c82463affcf%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, 1:15am UTC](https://discuss.elastic.co/t/incorrect-offset-length-values-in-phrase-suggester-result/18612/6 "2017-07-06T01:15:51Z")

</div>


