Failed to add StatisticalFacet on a integer type field ( NumberFormatException: Invalid shift value in prefixCoded string (is encoded value really an INT?) )

Hi,

I’ve added the following mapping:

{"user":{"properties":{"name":{"type":"string","store":"yes"},"visits":{"type":"integer","store":"yes"},"comments":{"type":"string","store":"yes"}}}}

And indexing few documents.

Using the java API, I want to add facet FacetBuilders.statisticalFacet(
"facet" ).field( “visits” ), but exception is raised:

[2012-11-29 08:25:34,570][DEBUG][action.search.type ] [Rose] [user][0],
node[pkseu6UeSd-cYlT9kA3bWw], [P], s[STARTED]: Failed to execute
[org.elasticsearch.action.search.SearchRequest@62edc88b]

org.elasticsearch.search.query.QueryPhaseExecutionException: [user][0]:
query[name:"Igor"],from[0],size[10000000]: Query Failed [Failed to execute
main query]
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:198)
at
org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:234)

at
org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:140)

at
org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:80)

at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:204)

at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:191)

at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$2.run(TransportSearchTypeAction.java:177)

at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

at java.lang.Thread.run(Thread.java:619)

Caused by: java.lang.NumberFormatException: Invalid shift value in
prefixCoded string (is encoded value really an INT?)

at
org.apache.lucene.util.NumericUtils.prefixCodedToInt(NumericUtils.java:232)
at org.apache.lucene.search.FieldCache$7.parseInt(FieldCache.java:243)
at
org.elasticsearch.index.field.data.ints.IntFieldData$IntTypeLoader.collectTerm(IntFieldData.java:150)

at
org.elasticsearch.index.field.data.support.FieldDataLoader.load(FieldDataLoader.java:55)

at
org.elasticsearch.index.field.data.ints.IntFieldData.load(IntFieldData.java:135)

at
org.elasticsearch.index.field.data.ints.IntFieldDataType.load(IntFieldDataType.java:91)

at
org.elasticsearch.index.field.data.ints.IntFieldDataType.load(IntFieldDataType.java:33)

at org.elasticsearch.index.field.data.FieldData.load(FieldData.java:111)
at
org.elasticsearch.index.cache.field.data.support.AbstractConcurrentMapFieldDataCache.cache(AbstractConcurrentMapFieldDataCache.java:123)

at
org.elasticsearch.search.facet.statistical.StatisticalFacetCollector.doSetNextReader(StatisticalFacetCollector.java:74)

at
org.elasticsearch.search.facet.AbstractFacetCollector.setNextReader(AbstractFacetCollector.java:75)

at
org.elasticsearch.common.lucene.MultiCollector.setNextReader(MultiCollector.java:67)

at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:576)
at
org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:195)

at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:445)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:426)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:342)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:330)
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:194)
... 9 more

Did I do something wrong in the mapping? When I run searches without the
facet, SearchHit. sourceAsMap().get( "visits" ) gets this field as Integer.

Thanks.

--

Could it be this issue
https://groups.google.com/d/topic/elasticsearch/PJ8V6LmYZRo/discussion ?

On Thursday, November 29, 2012 1:56:17 AM UTC-5, barak wrote:

Hi,

I’ve added the following mapping:

{"user":{"properties":{"name":{"type":"string","store":"yes"},"visits":{"type":"integer","store":"yes"},"comments":{"type":"string","store":"yes"}}}}

And indexing few documents.

Using the java API, I want to add facet FacetBuilders.statisticalFacet(
"facet" ).field( “visits” ), but exception is raised:

[2012-11-29 08:25:34,570][DEBUG][action.search.type ] [Rose] [user][0],
node[pkseu6UeSd-cYlT9kA3bWw], [P], s[STARTED]: Failed to execute
[org.elasticsearch.action.search.SearchRequest@62edc88b]

org.elasticsearch.search.query.QueryPhaseExecutionException: [user][0]:
query[name:"Igor"],from[0],size[10000000]: Query Failed [Failed to execute
main query]
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:198)
at
org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:234)

at
org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:140)

at
org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:80)

at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:204)

at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:191)

at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$2.run(TransportSearchTypeAction.java:177)

at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

at java.lang.Thread.run(Thread.java:619)

Caused by: java.lang.NumberFormatException: Invalid shift value in
prefixCoded string (is encoded value really an INT?)

at
org.apache.lucene.util.NumericUtils.prefixCodedToInt(NumericUtils.java:232)
at org.apache.lucene.search.FieldCache$7.parseInt(FieldCache.java:243)
at
org.elasticsearch.index.field.data.ints.IntFieldData$IntTypeLoader.collectTerm(IntFieldData.java:150)

at
org.elasticsearch.index.field.data.support.FieldDataLoader.load(FieldDataLoader.java:55)

at
org.elasticsearch.index.field.data.ints.IntFieldData.load(IntFieldData.java:135)

at
org.elasticsearch.index.field.data.ints.IntFieldDataType.load(IntFieldDataType.java:91)

at
org.elasticsearch.index.field.data.ints.IntFieldDataType.load(IntFieldDataType.java:33)

at org.elasticsearch.index.field.data.FieldData.load(FieldData.java:111)
at
org.elasticsearch.index.cache.field.data.support.AbstractConcurrentMapFieldDataCache.cache(AbstractConcurrentMapFieldDataCache.java:123)

at
org.elasticsearch.search.facet.statistical.StatisticalFacetCollector.doSetNextReader(StatisticalFacetCollector.java:74)

at
org.elasticsearch.search.facet.AbstractFacetCollector.setNextReader(AbstractFacetCollector.java:75)

at
org.elasticsearch.common.lucene.MultiCollector.setNextReader(MultiCollector.java:67)

at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:576)
at
org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:195)

at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:445)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:426)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:342)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:330)
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:194)
... 9 more

Did I do something wrong in the mapping? When I run searches without the
facet, SearchHit. sourceAsMap().get( "visits" ) gets this field as Integer.

Thanks.

--

Hi Barak,

I know this is an old question but Google got me here and you seems to have
the exact same issue as me,
did you remember any solution?

Thx!

On Thursday, November 29, 2012 7:56:17 AM UTC+1, barak wrote:

Hi,

I’ve added the following mapping:

{"user":{"properties":{"name":{"type":"string","store":"yes"},"visits":{"type":"integer","store":"yes"},"comments":{"type":"string","store":"yes"}}}}

And indexing few documents.

Using the java API, I want to add facet FacetBuilders.statisticalFacet(
"facet" ).field( “visits” ), but exception is raised:

[2012-11-29 08:25:34,570][DEBUG][action.search.type ] [Rose] [user][0],
node[pkseu6UeSd-cYlT9kA3bWw], [P], s[STARTED]: Failed to execute
[org.elasticsearch.action.search.SearchRequest@62edc88b]

org.elasticsearch.search.query.QueryPhaseExecutionException: [user][0]:
query[name:"Igor"],from[0],size[10000000]: Query Failed [Failed to execute
main query]
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:198)
at
org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:234)

at
org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:140)

at
org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:80)

at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:204)

at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:191)

at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$2.run(TransportSearchTypeAction.java:177)

at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

at java.lang.Thread.run(Thread.java:619)

Caused by: java.lang.NumberFormatException: Invalid shift value in
prefixCoded string (is encoded value really an INT?)

at
org.apache.lucene.util.NumericUtils.prefixCodedToInt(NumericUtils.java:232)
at org.apache.lucene.search.FieldCache$7.parseInt(FieldCache.java:243)
at
org.elasticsearch.index.field.data.ints.IntFieldData$IntTypeLoader.collectTerm(IntFieldData.java:150)

at
org.elasticsearch.index.field.data.support.FieldDataLoader.load(FieldDataLoader.java:55)

at
org.elasticsearch.index.field.data.ints.IntFieldData.load(IntFieldData.java:135)

at
org.elasticsearch.index.field.data.ints.IntFieldDataType.load(IntFieldDataType.java:91)

at
org.elasticsearch.index.field.data.ints.IntFieldDataType.load(IntFieldDataType.java:33)

at org.elasticsearch.index.field.data.FieldData.load(FieldData.java:111)
at
org.elasticsearch.index.cache.field.data.support.AbstractConcurrentMapFieldDataCache.cache(AbstractConcurrentMapFieldDataCache.java:123)

at
org.elasticsearch.search.facet.statistical.StatisticalFacetCollector.doSetNextReader(StatisticalFacetCollector.java:74)

at
org.elasticsearch.search.facet.AbstractFacetCollector.setNextReader(AbstractFacetCollector.java:75)

at
org.elasticsearch.common.lucene.MultiCollector.setNextReader(MultiCollector.java:67)

at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:576)
at
org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:195)

at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:445)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:426)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:342)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:330)
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:194)
... 9 more

Did I do something wrong in the mapping? When I run searches without the
facet, SearchHit. sourceAsMap().get( "visits" ) gets this field as Integer.

Thanks.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Did you try this solution?
https://groups.google.com/d/topic/elasticsearch/PJ8V6LmYZRo/discussion

On Friday, April 19, 2013 11:15:51 AM UTC-4, Damien Alexandre wrote:

Hi Barak,

I know this is an old question but Google got me here and you seems to
have the exact same issue as me,
did you remember any solution?

Thx!

On Thursday, November 29, 2012 7:56:17 AM UTC+1, barak wrote:

Hi,

I’ve added the following mapping:

{"user":{"properties":{"name":{"type":"string","store":"yes"},"visits":{"type":"integer","store":"yes"},"comments":{"type":"string","store":"yes"}}}}

And indexing few documents.

Using the java API, I want to add facet FacetBuilders.statisticalFacet(
"facet" ).field( “visits” ), but exception is raised:

[2012-11-29 08:25:34,570][DEBUG][action.search.type ] [Rose] [user][0],
node[pkseu6UeSd-cYlT9kA3bWw], [P], s[STARTED]: Failed to execute
[org.elasticsearch.action.search.SearchRequest@62edc88b]

org.elasticsearch.search.query.QueryPhaseExecutionException: [user][0]:
query[name:"Igor"],from[0],size[10000000]: Query Failed [Failed to execute
main query]
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:198)
at
org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:234)

at
org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:140)

at
org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:80)

at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:204)

at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:191)

at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$2.run(TransportSearchTypeAction.java:177)

at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

at java.lang.Thread.run(Thread.java:619)

Caused by: java.lang.NumberFormatException: Invalid shift value in
prefixCoded string (is encoded value really an INT?)

at
org.apache.lucene.util.NumericUtils.prefixCodedToInt(NumericUtils.java:232)
at org.apache.lucene.search.FieldCache$7.parseInt(FieldCache.java:243)
at
org.elasticsearch.index.field.data.ints.IntFieldData$IntTypeLoader.collectTerm(IntFieldData.java:150)

at
org.elasticsearch.index.field.data.support.FieldDataLoader.load(FieldDataLoader.java:55)

at
org.elasticsearch.index.field.data.ints.IntFieldData.load(IntFieldData.java:135)

at
org.elasticsearch.index.field.data.ints.IntFieldDataType.load(IntFieldDataType.java:91)

at
org.elasticsearch.index.field.data.ints.IntFieldDataType.load(IntFieldDataType.java:33)

at org.elasticsearch.index.field.data.FieldData.load(FieldData.java:111)
at
org.elasticsearch.index.cache.field.data.support.AbstractConcurrentMapFieldDataCache.cache(AbstractConcurrentMapFieldDataCache.java:123)

at
org.elasticsearch.search.facet.statistical.StatisticalFacetCollector.doSetNextReader(StatisticalFacetCollector.java:74)

at
org.elasticsearch.search.facet.AbstractFacetCollector.setNextReader(AbstractFacetCollector.java:75)

at
org.elasticsearch.common.lucene.MultiCollector.setNextReader(MultiCollector.java:67)

at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:576)
at
org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:195)

at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:445)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:426)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:342)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:330)
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:194)
... 9 more

Did I do something wrong in the mapping? When I run searches without the
facet, SearchHit. sourceAsMap().get( "visits" ) gets this field as Integer.

Thanks.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Thanks Igor,

I just got the solution moment ago, it was tricky, here is my case:

I have a "catalog" index, with a "stuff" type with mapping fully set,
and a "foobar" type with some mapping only...

The error was happening when I was running a query with a Facet on my
"stuff" type,
on a "articles.price" field set to be a Float.

It take me some time to figure it out but my "foobar" documents were also
storing an "articles.price" field,
but I have not set any mapping to it yet! ES guessed it was a "Double" and
so,
I'm facing one of Elasticsearch's limitation : you can't have two field
with the same name with differents types in the same index
.

The fact is that I was not aware of my "foobar" document fields... Maybe
the Exception could give some advices about this?

Anyway, glad it's solved now, thanks!

On Friday, April 19, 2013 5:27:43 PM UTC+2, Igor Motov wrote:

Did you try this solution?
https://groups.google.com/d/topic/elasticsearch/PJ8V6LmYZRo/discussion

On Friday, April 19, 2013 11:15:51 AM UTC-4, Damien Alexandre wrote:

Hi Barak,

I know this is an old question but Google got me here and you seems to
have the exact same issue as me,
did you remember any solution?

Thx!

On Thursday, November 29, 2012 7:56:17 AM UTC+1, barak wrote:

Hi,

I’ve added the following mapping:

{"user":{"properties":{"name":{"type":"string","store":"yes"},"visits":{"type":"integer","store":"yes"},"comments":{"type":"string","store":"yes"}}}}

And indexing few documents.

Using the java API, I want to add facet FacetBuilders.statisticalFacet(
"facet" ).field( “visits” ), but exception is raised:

[2012-11-29 08:25:34,570][DEBUG][action.search.type ] [Rose] [user][0],
node[pkseu6UeSd-cYlT9kA3bWw], [P], s[STARTED]: Failed to execute
[org.elasticsearch.action.search.SearchRequest@62edc88b]

org.elasticsearch.search.query.QueryPhaseExecutionException: [user][0]:
query[name:"Igor"],from[0],size[10000000]: Query Failed [Failed to execute
main query]
at
org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:198)
at
org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:234)

at
org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:140)

at
org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:80)

at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:204)

at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:191)

at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$2.run(TransportSearchTypeAction.java:177)

at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

at java.lang.Thread.run(Thread.java:619)

Caused by: java.lang.NumberFormatException: Invalid shift value in
prefixCoded string (is encoded value really an INT?)

at
org.apache.lucene.util.NumericUtils.prefixCodedToInt(NumericUtils.java:232)
at org.apache.lucene.search.FieldCache$7.parseInt(FieldCache.java:243)
at
org.elasticsearch.index.field.data.ints.IntFieldData$IntTypeLoader.collectTerm(IntFieldData.java:150)

at
org.elasticsearch.index.field.data.support.FieldDataLoader.load(FieldDataLoader.java:55)

at
org.elasticsearch.index.field.data.ints.IntFieldData.load(IntFieldData.java:135)

at
org.elasticsearch.index.field.data.ints.IntFieldDataType.load(IntFieldDataType.java:91)

at
org.elasticsearch.index.field.data.ints.IntFieldDataType.load(IntFieldDataType.java:33)

at org.elasticsearch.index.field.data.FieldData.load(FieldData.java:111)
at
org.elasticsearch.index.cache.field.data.support.AbstractConcurrentMapFieldDataCache.cache(AbstractConcurrentMapFieldDataCache.java:123)

at
org.elasticsearch.search.facet.statistical.StatisticalFacetCollector.doSetNextReader(StatisticalFacetCollector.java:74)

at
org.elasticsearch.search.facet.AbstractFacetCollector.setNextReader(AbstractFacetCollector.java:75)

at
org.elasticsearch.common.lucene.MultiCollector.setNextReader(MultiCollector.java:67)

at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:576)
at
org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:195)

at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:445)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:426)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:342)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:330)
at
org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:194)
... 9 more

Did I do something wrong in the mapping? When I run searches without the
facet, SearchHit. sourceAsMap().get( "visits" ) gets this field as Integer.

Thanks.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.