# Custom analyzer on multi field error (ES version 5.1.1 PHP API)

**URL:** <https://discuss.elastic.co/t/custom-analyzer-on-multi-field-error-es-version-5-1-1-php-api/70526>\
**Category:** Elasticsearch\
**Created:** [January 4, 2017, 9:06am UTC](https://discuss.elastic.co/t/custom-analyzer-on-multi-field-error-es-version-5-1-1-php-api/70526 "2017-01-04T09:06:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![barry1](https://avatars.discourse-cdn.com/v4/letter/b/7bcc69/32.png) [@barry1](https://discuss.elastic.co/u/barry1)\
**Post date:** [January 4, 2017, 9:06am UTC](https://discuss.elastic.co/t/custom-analyzer-on-multi-field-error-es-version-5-1-1-php-api/70526/1 "2017-01-04T09:06:00Z")

</div>

Hello,

We are trying to upgrade from ES version 2.3.1 to 5.1.1. So now I'm changing the code to create the index and the mapping, but I'm getting this strange error message.

> Elasticsearch Error: mapper\_parsing\_exception: Mapping definition for [fields] has unsupported parameters: [analyzer : lowercase] (400)

The code I use to create the index and mapping:

```
$aParams = [
	'index' => 'my_index',
	'body' => [
		'settings' => [
			'analysis' => [
				'analyzer' => [
					'lowercase' => [
						'type' => 'custom',
						'tokenizer' => 'keyword',
						'filter' => ['lowercase'],
					]
				]
			]
		]
	]
];
$oElastic->indices()->create( $aParams );

$aMapping = [
	'index' => 'my_index',
	'type' => 'my_type',
	'body' => [
		'my_type' => [
			'_source' => [
				'enabled' => true,
			],
			'properties' => [
				'my_field' => [
					'type' => 'keyword',
					'analyzer' => 'dutch',
					'fields' => [
						'lowercase' => [
							'type' => 'keyword',
							'analyzer' => 'lowercase',
						],
						'raw' => [
							'type' => 'keyword',
							'index' => false,
						]
					]
				]
			]
		]
	]
];
$oElastic->indices()->putMapping( $aMapping );

```

Any thoughts?

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [January 5, 2017, 8:44am UTC](https://discuss.elastic.co/t/custom-analyzer-on-multi-field-error-es-version-5-1-1-php-api/70526/2 "2017-01-05T08:44:00Z")

</div>

Hi @barry1,

Analyzers on `keyword` fields are not supported in Elasticsearch 5.1.1.. We have implemented support for that in [#21919](https://github.com/elastic/elasticsearch/pull/21919) which is coming in Elasticsearch 5.2. It's hard to tell from your example but did you check you need a `keyword` field instead of a `text` field?

Daniel

---

<div class="post-metadata">

**Author:** ![barry1](https://avatars.discourse-cdn.com/v4/letter/b/7bcc69/32.png) [@barry1](https://discuss.elastic.co/u/barry1)\
**Post date:** [January 5, 2017, 9:09am UTC](https://discuss.elastic.co/t/custom-analyzer-on-multi-field-error-es-version-5-1-1-php-api/70526/3 "2017-01-05T09:09:01Z")

</div>

Aha, I see.

The code I gave is just an simplified example. We're building our mapping based on a dynamic mysql database, so every varchar will become a `text` now instead of a `keyword` (was `string` in 2.3).

Maybe I can do some less dynamic stuff a see if some varchar's need to be a `keyword` and some other have to be `text`.

Thank's for the solution!

---

<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:** [January 8, 2017, 9:09am UTC](https://discuss.elastic.co/t/custom-analyzer-on-multi-field-error-es-version-5-1-1-php-api/70526/4 "2017-01-08T09:09:03Z")

</div>

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
