Highlighting with terms query StringIndexOutOfBoundsException on 1 shard


(Matt D.) #1

So I'm just starting out with ElasticaSearch so I'm still learning the
ropes, but as the title states in this particular occurance I'm getting an
exception back from my query. Any help would be greatly appreciated.

{
"query": {
"terms": {
"message": [
"call",
"publication"
]
}
},
"size": 10,
"highlight": {
"pre_tags": [
""
],
"post_tags": [
""
],
"fields": {
"message": {
"fragment_size": 200,
"number_of_fragments": 1,
"term_vector": "with_positions_offsets"
}
}
}
}

And when I try to run it I get the following error from one of my shards.
If I run it with the terms individually it displays as I would expect it to.

  • timed_out: false
  • _shards: {
    • total: 5
    • successful: 4
    • failed: 1
    • failures: [
      • {
        • index: index_30000
        • shard: 0
        • status: 500
        • reason: FetchPhaseExecutionException[[index_30000][0]:
          query[message:call message:publication],from[0],size[10]: Fetch Failed
          [Failed to highlight field [message]]]; nested:
          StringIndexOutOfBoundsException[String index out of range: -30];
          }
          ]
          }

Finally I'm using the following String & search analyzers in the index
'number_of_shards' => 5,
'number_of_replicas' => 1,
'analysis' => array(
'analyzer' => array(
'str_index_analyzer' => array(
'tokenizer' => 'keyword',
'filter' => array('lowercase', 'substring')
),
'str_search_analyzer' => array(
'tokenizer' => 'keyword',
'filter' => array('lowercase')
)
),
'filter' => array(
'substring' => array(
'type' => 'nGram',
'min_gram' => 1,
'max_gram' => 20
)
)
)

And this is the mapping for that particular field.
'message' => array(
'type' => 'string',
'index_analyzer' => 'str_index_analyzer',
'search_analyzer' => 'str_search_analyzer',
'store' => 'yes',
'term_vector' => 'with_positions_offsets'
)

--


(system) #2