Hi,
I have a field 'customValue' typed as integer in type 'type1' and as long
in type 'type2'. Terms facets on the field is failing. Following is the
gist:
curl -XDELETE 'http://localhost:9200/try_test/'
curl -XPOST http://localhost:9200/try_test -d '{
"index": {
"number_of_shards": 1,
"number_of_replicas": 0
}
}'
curl -XPUT 'http://localhost:9200/try_test/type1/_mapping' -d '{
"type1": {
"_source": {
"enabled": true
},
"properties": {
"customId": {
"type": "integer",
"index": "analyzed"
},
"customValue": {
"type": "integer",
"index": "analyzed"
}
}
}
}'
curl -XPUT 'http://localhost:9200/try_test/type2/_mapping' -d '{
"type2": {
"_source": {
"enabled": true
},
"properties": {
"customId": {
"type": "integer",
"index": "analyzed"
},
"customValue": {
"type": "long",
"index": "analyzed"
}
}
}
}'
curl -XPOST 'http://localhost:9200/try_test/type1/' -d '{
"customId": 2301,
"customValue": 67
}'
curl -XPOST 'http://localhost:9200/try_test/type2/' -d '{
"customId": 2302,
"customValue": 678917349187249
}'
curl -XGET 'http://localhost:9200/try_test/_search?pretty=true' -d '{
"query": {
"match_all": {}
},
"from": 0,
"size": 0,
"facets": {
"facet1": {
"terms": {
"field": "customValue",
"size": 10
}
}
}
}'
Failing, which is expected. Trying to facet simultaneously on two
different types can be illegal.
curl -XGET 'http://localhost:9200/try_test/type1/_search?pretty=true' -d '{
"query": {
"match_all": {}
},
"from": 0,
"size": 0,
"facets": {
"facet1": {
"terms": {
"field": "customValue",
"size": 10
}
}
}
}'
Failing, why? It should give result, as does the next one.
curl -XGET 'http://localhost:9200/try_test/type2/_search?pretty=true' -d '{
"query": {
"match_all": {}
},
"from": 0,
"size": 0,
"facets": {
"facet1": {
"terms": {
"field": "customValue",
"size": 10
}
}
}
}'
Working.
The exception is the following :
{
"error" : "SearchPhaseExecutionException[Failed to execute phase
[query_fetch], total failure; shardFailures
{[h5W2XmgPTKS6pDylfkqBZQ][try_test][0]:
QueryPhaseExecutionException[[try_test][0]:
query[ConstantScore(NotDeleted(cache(_type:type1)))],from[0],size[0]: Query
Failed [Failed to execute main query]]; nested:
NumberFormatException[Invalid shift value in prefixCoded string (is encoded
value really an INT?)]; }]",
"status" : 500
}
Any hint on how to resolve this? Making everything as long is one solution,
I know, but other than that? This is failing on both 0.19 and 0.20 version.
Thanks in advance,
-- Sujoy.
--