# Accessing tokens of an inner field

**URL:** <https://discuss.elastic.co/t/accessing-tokens-of-an-inner-field/13967>\
**Category:** Elasticsearch\
**Created:** [October 16, 2013, 9:54am UTC](https://discuss.elastic.co/t/accessing-tokens-of-an-inner-field/13967 "2013-10-16T09:54:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pdesoyres](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pdesoyres/32/509_2.png) [@pdesoyres](https://discuss.elastic.co/u/pdesoyres)\
**Post date:** [October 16, 2013, 9:54am UTC](https://discuss.elastic.co/t/accessing-tokens-of-an-inner-field/13967/1 "2013-10-16T09:54:25Z")

</div>

Hi,

I'm trying to access generated token on a inner field .

Assuming the following mapping :

{  
"myMapping" : {  
"properties" : {  
"simple\_field" : {"type" : "string", "store" : "yes"},  
"complex\_object" : {  
"properties" : {  
"inner\_field" : {"type" : "string", "store" : "yes"}  
}  
}  
}  
}  
}

curl '[http://localhost:9200/test\_index/myMapping/\_search?pretty=true](http://localhost:9200/test_index/myMapping/_search?pretty=true)' -d '{  
"query" : {  
"match" : {  
"\_id" : 24  
}  
},  
"script\_fields": {  
"terms" : {  
"script": "doc[field].values",  
"params": {  
\* "field": "simple\_field"\*  
}  
}  
}  
}'

when asking tokens of field "simple\_field", all is going fine. But when I  
ask for "_complex\_object.inner\_field_", I get the following error :  
RuntimeException[unable to invoke method]; nested:  
InvocationTargetException; nested: ArrayIndexOutOfBoundsException[10];

Is there any way (excluding analyze API) to get the tokens generated for an  
object inner field of a single document ? (I'm using elasticsearch 0.90.0.)

Thanks for helping

Pierre.

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [October 17, 2013, 1:31pm UTC](https://discuss.elastic.co/t/accessing-tokens-of-an-inner-field/13967/2 "2013-10-17T13:31:30Z")

</div>

Hi Pierre,  
do you have the whole stacktrace of that error? I would be curious to know  
more about it.

What you are trying to do is not possible with 0.90 but will be possible in  
1.0 storing term\_vectors and using the term\_vectors api  
([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-termvectors.html)).

On Wednesday, October 16, 2013 11:54:25 AM UTC+2, Pierre de Soyres wrote:

> Hi,
> 
> I'm trying to access generated token on a inner field .
> 
> Assuming the following mapping :
> 
> {  
> "myMapping" : {  
> "properties" : {  
> "simple\_field" : {"type" : "string", "store" : "yes"},  
> "complex\_object" : {  
> "properties" : {  
> "inner\_field" : {"type" : "string", "store" : "yes"}  
> }  
> }  
> }  
> }  
> }
> 
> curl '[http://localhost:9200/test\_index/myMapping/\_search?pretty=true](http://localhost:9200/test_index/myMapping/_search?pretty=true)' -d  
> '{  
> "query" : {  
> "match" : {  
> "\_id" : 24  
> }  
> },  
> "script\_fields": {  
> "terms" : {  
> "script": "doc[field].values",  
> "params": {  
> \* "field": "simple\_field"\*  
> }  
> }  
> }  
> }'
> 
> when asking tokens of field "simple\_field", all is going fine. But when I  
> ask for "_complex\_object.inner\_field_", I get the following error :  
> RuntimeException[unable to invoke method]; nested:  
> InvocationTargetException; nested: ArrayIndexOutOfBoundsException[10];
> 
> Is there any way (excluding analyze API) to get the tokens generated for  
> an object inner field of a single document ? (I'm using elasticsearch  
> 0.90.0.)
> 
> Thanks for helping
> 
> Pierre.

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [October 17, 2013, 1:33pm UTC](https://discuss.elastic.co/t/accessing-tokens-of-an-inner-field/13967/3 "2013-10-17T13:33:07Z")

</div>

Sorry, to clarify what I previously wrote, I'm not aware of any other way  
to do what you are trying to do with 0.90, but if you provide the  
stacktrace we can look into the problem with inner objects and see what we  
can do to fix that.

On Thursday, October 17, 2013 3:31:30 PM UTC+2, Luca Cavanna wrote:

> Hi Pierre,  
> do you have the whole stacktrace of that error? I would be curious to know  
> more about it.
> 
> What you are trying to do is not possible with 0.90 but will be possible  
> in 1.0 storing term\_vectors and using the term\_vectors api (  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-termvectors.html)  
> ).
> 
> On Wednesday, October 16, 2013 11:54:25 AM UTC+2, Pierre de Soyres wrote:
> 
> > Hi,
> > 
> > I'm trying to access generated token on a inner field .
> > 
> > Assuming the following mapping :
> > 
> > {  
> > "myMapping" : {  
> > "properties" : {  
> > "simple\_field" : {"type" : "string", "store" : "yes"},  
> > "complex\_object" : {  
> > "properties" : {  
> > "inner\_field" : {"type" : "string", "store" : "yes"}  
> > }  
> > }  
> > }  
> > }  
> > }
> > 
> > curl '[http://localhost:9200/test\_index/myMapping/\_search?pretty=true](http://localhost:9200/test_index/myMapping/_search?pretty=true)' -d  
> > '{  
> > "query" : {  
> > "match" : {  
> > "\_id" : 24  
> > }  
> > },  
> > "script\_fields": {  
> > "terms" : {  
> > "script": "doc[field].values",  
> > "params": {  
> > \* "field": "simple\_field"\*  
> > }  
> > }  
> > }  
> > }'
> > 
> > when asking tokens of field "simple\_field", all is going fine. But when I  
> > ask for "_complex\_object.inner\_field_", I get the following error :  
> > RuntimeException[unable to invoke method]; nested:  
> > InvocationTargetException; nested: ArrayIndexOutOfBoundsException[10];
> > 
> > Is there any way (excluding analyze API) to get the tokens generated for  
> > an object inner field of a single document ? (I'm using elasticsearch  
> > 0.90.0.)
> > 
> > Thanks for helping
> > 
> > Pierre.

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:11am UTC](https://discuss.elastic.co/t/accessing-tokens-of-an-inner-field/13967/4 "2017-07-06T02:11:55Z")

</div>

Closed on July 6, 2017, 2:11am UTC


