[mapper [title] has different [analyzer]]
See original GitHub issueIssue Summary
I can’t pass this error condition, all models are pretty similar, there are not custom title fields in the models, I believe must be missing something that needs to be added to the project settings but I have read all documentation I found regarding elasticsearch support and nothing seems out of place.
Project settings:
WAGTAILSEARCH_BACKENDS = {
'default': {
'BACKEND': 'wagtail.search.backends.elasticsearch6',
'URLS': ['http://localhost:9200'],
'INDEX': 'wagtail',
'TIMEOUT': 5,
'OPTIONS': {},
'INDEX_SETTINGS': {},
'AUTO_UPDATE': True,
'ATOMIC_REBUILD': True
}
}
Technical details
- Python version: Python 3.7.0b5.
- Django version: Version: 2.0.8.
- Wagtail version: Version: 2.1.1.
- OS: Windows 10 Pro Version 1803 Build 17134.81
Output
$ python manage.py update_index --backend default
Updating backend: default
default: Rebuilding index wagtail__wagtailcore_page
PUT http://localhost:9200/wagtail__wagtailcore_page_sspzhjb/_mapping/doc?update_all_types=true [status:400 request:0.010s]
Traceback (most recent call last):
File "manage.py", line 23, in <module>
execute_from_command_line(sys.argv)
File "C:\Projects\liu-wagtail-cms\env\lib\site-packages\django\core\management\__init__.py", line 371, in execute_from_command_line
utility.execute()
File "C:\Projects\liu-wagtail-cms\env\lib\site-packages\django\core\management\__init__.py", line 365, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Projects\liu-wagtail-cms\env\lib\site-packages\django\core\management\base.py", line 288, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Projects\liu-wagtail-cms\env\lib\site-packages\django\core\management\base.py", line 335, in execute
output = self.handle(*args, **options)
File "C:\Projects\liu-wagtail-cms\env\lib\site-packages\wagtail\search\management\commands\update_index.py", line 125, in handle
schema_only=options.get('schema_only', False), chunk_size=options.get('chunk_size')
File "C:\Projects\liu-wagtail-cms\env\lib\site-packages\wagtail\search\management\commands\update_index.py", line 77, in update_backend
index.add_model(model)
File "C:\Projects\liu-wagtail-cms\env\lib\site-packages\wagtail\search\backends\elasticsearch2.py", line 786, in add_model
update_all_types=True
File "C:\Projects\liu-wagtail-cms\env\lib\site-packages\elasticsearch\client\utils.py", line 76, in _wrapped
return func(*args, params=params, **kwargs)
File "C:\Projects\liu-wagtail-cms\env\lib\site-packages\elasticsearch\client\indices.py", line 271, in put_mapping
'_mapping', doc_type), params=params, body=body)
File "C:\Projects\liu-wagtail-cms\env\lib\site-packages\elasticsearch\transport.py", line 318, in perform_request
status, headers_response, data = connection.perform_request(method, url, params, body, headers=headers, ignore=ignore, timeout=timeout)
File "C:\Projects\liu-wagtail-cms\env\lib\site-packages\elasticsearch\connection\http_urllib3.py", line 185, in perform_request
self._raise_error(response.status, raw_data)
File "C:\Projects\liu-wagtail-cms\env\lib\site-packages\elasticsearch\connection\base.py", line 125, in _raise_error
raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
elasticsearch.exceptions.RequestError: TransportError(400, 'illegal_argument_exception', 'Mapper for [title] conflicts
with existing mapping in other types:\n[mapper [title] has different [analyzer]]')
The same with some traces I added to the http_urllib3.py code to have an idea what is going on:
$ python manage.py update_index --backend default
Updating backend: default
default: Rebuilding index wagtail__wagtailcore_page
URL:
/wagtail__wagtailcore_page
BODY:
None
URL:
/wagtail__wagtailcore_page
BODY:
b'{"settings":{"analysis":{"analyzer":{"ngram_analyzer":{"type":"custom","tokenizer":"lowercase","filter":["asciifolding","ngram"]},"edgengram_analyzer":{"type":"custom","tokenizer":"lowercase","filter":["asciifolding","edgengram"]}},"tokenizer":{"ngram_tokenizer":{"type":"nGram","min_gram":3,"max_gram":15},"edgengram_tokenizer":{"type":"edgeNGram","min_gram":2,"max_gram":15,"side":"front"}},"filter":{"ngram":{"type":"nGram","min_gram":3,"max_gram":15},"edgengram":{"type":"edgeNGram","min_gram":1,"max_gram":15}}}},"mappings":{"doc":{"properties":{"title":{"type":"text","boost":2,"analyzer":"edgengram_analyzer","search_analyzer":"standard","copy_to":"_all_text"}}}}}'
URL:
/wagtail__wagtailcore_page/_mapping/doc?update_all_types=true
BODY:
b'{"doc":{"properties":{"pk":{"type":"keyword","store":true},"content_type":{"type":"keyword"},"_edgengrams":{"type":"text","analyzer":"edgengram_analyzer","search_analyzer":"standard"},"title":{"type":"text","boost":2,"analyzer":"edgengram_analyzer","search_analyzer":"standard","copy_to":"_all_text"},"title_filter":{"type":"keyword"},"id_filter":{"type":"integer"},"live_filter":{"type":"boolean"},"owner_id_filter":{"type":"keyword"},"content_type_id_filter":{"type":"keyword"},"path_filter":{"type":"keyword"},"depth_filter":{"type":"integer"},"locked_filter":{"type":"boolean"},"show_in_menus_filter":{"type":"boolean"},"first_published_at_filter":{"type":"date"},"last_published_at_filter":{"type":"date"},"latest_revision_created_at_filter":{"type":"date"},"home_link__tags":{"type":"text","copy_to":"_all_text"},"_all_text":{"type":"text"}}}}'
URL:
/wagtail__wagtailcore_page/_mapping/doc?update_all_types=true
BODY:
b'{"doc":{"properties":{"pk":{"type":"keyword","store":true},"content_type":{"type":"keyword"},"_edgengrams":{"type":"text","analyzer":"edgengram_analyzer","search_analyzer":"standard"},"title":{"type":"text","boost":2,"analyzer":"edgengram_analyzer","search_analyzer":"standard","copy_to":"_all_text"},"title_filter":{"type":"keyword"},"id_filter":{"type":"integer"},"live_filter":{"type":"boolean"},"owner_id_filter":{"type":"keyword"},"content_type_id_filter":{"type":"keyword"},"path_filter":{"type":"keyword"},"depth_filter":{"type":"integer"},"locked_filter":{"type":"boolean"},"show_in_menus_filter":{"type":"boolean"},"first_published_at_filter":{"type":"date"},"last_published_at_filter":{"type":"date"},"latest_revision_created_at_filter":{"type":"date"},"_all_text":{"type":"text"}}}}'
URL:
/wagtail__wagtailcore_page/_mapping/doc?update_all_types=true
BODY:
b'{"doc":{"properties":{"pk":{"type":"keyword","store":true},"content_type":{"type":"keyword"},"_edgengrams":{"type":"text","analyzer":"edgengram_analyzer","search_analyzer":"standard"},"title":{"type":"text","copy_to":"_all_text"},"title_filter":{"type":"keyword"},"id_filter":{"type":"integer"},"live_filter":{"type":"boolean"},"owner_id_filter":{"type":"keyword"},"content_type_id_filter":{"type":"keyword"},"path_filter":{"type":"keyword"},"depth_filter":{"type":"integer"},"locked_filter":{"type":"boolean"},"show_in_menus_filter":{"type":"boolean"},"first_published_at_filter":{"type":"date"},"last_published_at_filter":{"type":"date"},"latest_revision_created_at_filter":{"type":"date"},"home_landingpage__tags":{"type":"text","copy_to":"_all_text"},"_all_text":{"type":"text"}}}}'
PUT http://localhost:9200/wagtail__wagtailcore_page/_mapping/doc?update_all_types=true [status:400 request:0.023s]
Traceback (most recent call last):
File "manage.py", line 23, in <module>
execute_from_command_line(sys.argv)
File "C:\Projects\liu-wagtail-cms\env\lib\site-packages\django\core\management\__init__.py", line 371, in execute_from_command_line
utility.execute()
File "C:\Projects\liu-wagtail-cms\env\lib\site-packages\django\core\management\__init__.py", line 365, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Projects\liu-wagtail-cms\env\lib\site-packages\django\core\management\base.py", line 288, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Projects\liu-wagtail-cms\env\lib\site-packages\django\core\management\base.py", line 335, in execute
output = self.handle(*args, **options)
File "C:\Projects\liu-wagtail-cms\env\lib\site-packages\wagtail\search\management\commands\update_index.py", line 125, in handle
schema_only=options.get('schema_only', False), chunk_size=options.get('chunk_size')
File "C:\Projects\liu-wagtail-cms\env\lib\site-packages\wagtail\search\management\commands\update_index.py", line 77, in update_backend
index.add_model(model)
File "C:\Projects\liu-wagtail-cms\env\lib\site-packages\wagtail\search\backends\elasticsearch2.py", line 786, in add_model
update_all_types=True
File "C:\Projects\liu-wagtail-cms\env\lib\site-packages\elasticsearch\client\utils.py", line 76, in _wrapped
return func(*args, params=params, **kwargs)
File "C:\Projects\liu-wagtail-cms\env\lib\site-packages\elasticsearch\client\indices.py", line 271, in put_mapping
'_mapping', doc_type), params=params, body=body)
File "C:\Projects\liu-wagtail-cms\env\lib\site-packages\elasticsearch\transport.py", line 318, in perform_request
status, headers_response, data = connection.perform_request(method, url, params, body, headers=headers, ignore=ignore, timeout=timeout)
File "C:\Projects\liu-wagtail-cms\env\lib\site-packages\elasticsearch\connection\http_urllib3.py", line 189, in perform_request
self._raise_error(response.status, raw_data)
File "C:\Projects\liu-wagtail-cms\env\lib\site-packages\elasticsearch\connection\base.py", line 125, in _raise_error
raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
elasticsearch.exceptions.RequestError: TransportError(400, 'illegal_argument_exception', 'Mapper for [title] conflicts
with existing mapping in other types:\n[mapper [title] has different [analyzer]]')
I notice that the title property settings changed in the last request from:
"title": {
"type": "text",
"boost": 2,
"analyzer": "edgengram_analyzer",
"search_analyzer": "standard",
"copy_to": "_all_text"
}
to:
"title": {
"type": "text",
"copy_to": "_all_text"
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Conflicts with existing mapping - Elasticsearch - Elastic Discuss
"Mapper for [uUserId] conflicts with existing mapping in other types:\n[mapper [uUserId] has different [analyzer], mapper [uUserId] is used ...
Read more >Mapper for conflicts with existing mapping - Stack Overflow
If I create mappings before putting data in it works just fine. This just says it all, doesn't it? If you first insert...
Read more >Couldn't update existing mappings. You may need to reindex.
php", I got below error, "Couldn't update existing mappings. You may need to reindex.", I am totally new to search engine, can anyone...
Read more >Analyzer and search_analyzer on field - Opster
A detailed guide on how to resolve errors related to "analyzer and search_analyzer on field"
Read more >Elasticsearch Mapping Basics & Examples (After Create Index)
Each mapping type had fields or properties that meta-fields and various data ... For example, a “ user ” type may contain fields...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If anyone else bumps in to this, the issue was adding:
index.SearchField("title", boost=2)
to a page search_fields, which is redundantThis one pointed me to it…
It looks like you need to keep the
partial_match
attribute in the constructor call. E.g.index.SearchField("title", partial_match=True, boost=1),