Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [question_index] => Array
- (
- [mappings] => Array
- (
- [QUESTION] => Array
- (
- [properties] => Array
- (
- [body] => Array
- (
- [type] => string
- )
- [general_suggest] => Array
- (
- [type] => completion
- [analyzer] => simple
- [payloads] => 1
- [preserve_separators] => 1
- [preserve_position_increments] => 1
- [max_input_length] => 50
- )
- )
- )
- )
- )
- $param['index'] = 'question_index';
- $param['type'] = 'QUESTION';
- $param['body'] = array(
- '_source' => array(
- 'enabled' => true
- ),
- 'properties' => array(
- 'body' => array('type' => 'string'),
- 'general_suggest' => array(
- 'type' => 'completion',
- 'index_analyzer' => 'simple',
- 'search_analyzer' => 'simple',
- 'payloads' => true
- )
- )
- );
- $result = $client->indices()->putMapping($param);
- $param = array();
- $param['index'] = 'question_index';
- $param['body']['text'] = 'someth';//should return 'something' as a suggest
- $param['body']['completion']['field'] = 'general_suggest';
- $result = $client->suggest($param);
- Array
- (
- [_shards] => Array
- (
- [total] => 5
- [successful] => 0
- [failed] => 5
- [failures] => Array
- (
- [0] => Array
- (
- [index] => question_index
- [shard] => 0
- [reason] => BroadcastShardOperationFailedException[[question_index][0] ]; nested: ElasticsearchException[failed to execute suggest]; nested: ElasticsearchIllegalArgumentException[[suggest] does not support [field]];
- )
Add Comment
Please, Sign In to add comment