ElasticSearch 7.x default does not support the specified index type

Original: elasticsearch 7.x default does not support the specified index type

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/u014646662/article/details/94718834

ElasticSearch 7.x default does not support the specified index type

Executed on elasticsearch7.x:
 


   
   
  1. put es_test
  2. {
  3. "settings":{
  4. "number_of_shards" : 3,
  5. "number_of_replicas" : 0
  6. },
  7. "mappings":{
  8. "books":{
  9. "properties":{
  10. "title":{ "type": "text"},
  11. "name":{ "type": "text", "index": false},
  12. "publish_date":{ "type": "date", "index": false},
  13. "price":{ "type": "double"},
  14. "number":{
  15. "type": "object",
  16. "dynamic": true
  17. }
  18. }
  19. }
  20. }
  21. }

The results will be wrong: Root mapping definition has unsupported parameters


   
   
  1. {
  2. "error": {
  3. "root_cause": [
  4. {
  5. "type": "mapper_parsing_exception",
  6. "reason": "Root mapping definition has unsupported parameters: [books : {properties={number={dynamic=true, type=object}, price={type=double}, name={index=false, type=text}, title={type=text}, publish_date={index=false, type=date}}}]"
  7. }
  8. ],
  9. "type": "mapper_parsing_exception",
  10. "reason": "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [books : {properties={number={dynamic=true, type=object}, price={type=double}, name={index=false, type=text}, title={type=text}, publish_date={index=false, type=date}}}]",
  11. "caused_by": {
  12. "type": "mapper_parsing_exception",
  13. "reason": "Root mapping definition has unsupported parameters: [books : {properties={number={dynamic=true, type=object}, price={type=double}, name={index=false, type=text}, title={type=text}, publish_date={index=false, type=date}}}]"
  14. }
  15. },
  16. "status": 400
  17. }

If executed on 6.x, are executed normally


   
   
  1. {
  2. "acknowledged" : true
  3. }

This occurs because, elasticsearch7 default does not support the specified index type, default index type is _doc, if you want to change, include_type_name configure: true to (this is not a test, the official said the document, whether it is feasible, it is recommended not to do so because after elasticsearch8 not provide this field). The official document: https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html

So Elasticsearch7 should create an index so


   
   
  1. put / test
  2. {
  3. "settings":{
  4. "number_of_shards":3,
  5. "number_of_replicas":2
  6. },
  7. "mappings":{
  8. "properties":{
  9. "id":{ "type": "long"},
  10. "name":{ "type": "text", "analyzer": "ik_smart"},
  11. "text":{ "type": "text", "analyzer": "ik_max_word"}
  12. }
  13. }
  14. }
  15. put /test1
  16. {
  17. "settings":{
  18. "number_of_shards":3,
  19. "number_of_replicas":2
  20. },
  21. "mappings":{
  22. "properties":{
  23. "id":{ "type": "long"},
  24. "name":{ "type": "text"},
  25. "text":{ "type": "text"}
  26. }
  27. }
  28. }

For students interested in artificial intelligence, you can click on the following link:

AI is now very popular, many of my friends want to learn, but the general course is to prepare students Boshuo, too difficult to read the. Recently I discovered a great tutorial for white entry, not only easy to understand and very humorous. So I could not help but share to everyone. Click here to jump to the tutorial.

https://www.cbedai.net/u014646662

Guess you like

Origin www.cnblogs.com/lonelyxmas/p/11612940.html