在弹性搜索中保存文档时出错。 mapper [rank.raw]无法从[long]类型更改为[string]

时间:2016-08-14 09:35:13

标签: elasticsearch

弹性中的映射:

{
  "86eb38ec-d57d-365c-af3b-1680e3aabf74": {
    "mappings": {
      "lessaccounting": {
        "_all": {
          "enabled": true,
          "analyzer": "edgeNGram_analyzer",
          "search_analyzer": "standard"
        },
        "dynamic_templates": [
          {
            "strings": {
              "include_in_all": true,
              "mapping": {
                "type": "string",
                "fields": {
                  "raw": {
                    "index": "not_analyzed",
                    "type": "string"
                  }
                }
              },
              "match_mapping_type": "string"
            }
          },
          {
            "longs": {
              "include_in_all": true,
              "mapping": {
                "type": "string",
                "fields": {
                  "raw": {
                    "type": "long"
                  }
                }
              },
              "match_mapping_type": "long"
            }
          },
          {
            "doubles": {
              "include_in_all": true,
              "mapping": {
                "type": "string",
                "fields": {
                  "raw": {
                    "type": "double"
                  }
                }
              },
              "match_mapping_type": "double"
            }
          },
          {
            "integers": {
              "include_in_all": true,
              "mapping": {
                "type": "string",
                "fields": {
                  "raw": {
                    "type": "integer"
                  }
                }
              },
              "match_mapping_type": "integer"
            }
          }
        ],
        "properties": {
          "bucketName": {
            "type": "string",
            "fields": {
              "raw": {
                "type": "string",
                "index": "not_analyzed"
              }
            }
          },
          "companyID": {
            "type": "string",
            "fields": {
              "raw": {
                "type": "string",
                "index": "not_analyzed"
              }
            }
          },
          "createdTime": {
            "type": "string",
            "fields": {
              "raw": {
                "type": "long"
              }
            }
          },
          "currentState": {
            "type": "string",
            "fields": {
              "raw": {
                "type": "string",
                "index": "not_analyzed"
              }
            }
          },
          "currentUsers": {
            "type": "string",
            "fields": {
              "raw": {
                "type": "string",
                "index": "not_analyzed"
              }
            }
          },
          "documentKeyName": {
            "type": "string",
            "fields": {
              "raw": {
                "type": "string",
                "index": "not_analyzed"
              }
            }
          },
          "elibleFor1099": {
            "type": "boolean"
          },
          "flowName": {
            "type": "string",
            "fields": {
              "raw": {
                "type": "string",
                "index": "not_analyzed"
              }
            }
          },
          "history": {
            "type": "string",
            "fields": {
              "raw": {
                "type": "string",
                "index": "not_analyzed"
              }
            }
          },
          "id": {
            "type": "string",
            "fields": {
              "raw": {
                "type": "string",
                "index": "not_analyzed"
              }
            }
          },
          "lastUpdatedBy": {
            "type": "string",
            "fields": {
              "raw": {
                "type": "string",
                "index": "not_analyzed"
              }
            }
          },
          "lastUpdatedTime": {
            "type": "string",
            "fields": {
              "raw": {
                "type": "long"
              }
            }
          },
          "name": {
            "type": "string",
            "fields": {
              "raw": {
                "type": "string",
                "index": "not_analyzed"
              }
            }
          },
          "ownerID": {
            "type": "string",
            "fields": {
              "raw": {
                "type": "string",
                "index": "not_analyzed"
              }
            }
          },
          "rank": {
            "type": "string",
            "fields": {
              "raw": {
                "type": "long"
              }
            }
          },
          "subState": {
            "type": "string",
            "fields": {
              "raw": {
                "type": "string",
                "index": "not_analyzed"
              }
            }
          }
        }
      },
      "_default_": {
        "_all": {
          "enabled": true,
          "analyzer": "edgeNGram_analyzer",
          "search_analyzer": "standard"
        },
        "dynamic_templates": [
          {
            "strings": {
              "include_in_all": true,
              "mapping": {
                "type": "string",
                "fields": {
                  "raw": {
                    "index": "not_analyzed",
                    "type": "string"
                  }
                }
              },
              "match_mapping_type": "string"
            }
          },
          {
            "longs": {
              "include_in_all": true,
              "mapping": {
                "type": "string",
                "fields": {
                  "raw": {
                    "type": "long"
                  }
                }
              },
              "match_mapping_type": "long"
            }
          },
          {
            "doubles": {
              "include_in_all": true,
              "mapping": {
                "type": "string",
                "fields": {
                  "raw": {
                    "type": "double"
                  }
                }
              },
              "match_mapping_type": "double"
            }
          },
          {
            "integers": {
              "include_in_all": true,
              "mapping": {
                "type": "string",
                "fields": {
                  "raw": {
                    "type": "integer"
                  }
                }
              },
              "match_mapping_type": "integer"
            }
          }
        ]
      }
    }
  }
}

我试图保存以下文件:

{
  "name": "IMG_1141.JPG",
  "companyID": "Big Half",
  "ownerID": "test.io",
  "bucketName": "bighalf-user-documents-bucket",
  "documentKeyName": "IMG_1141.JPG"
}

这是保存文档时面临的错误。

java.lang.IllegalArgumentException: mapper [rank.raw] cannot be changed from type [long] to [string]
    at org.elasticsearch.index.mapper.MappedFieldType.checkTypeName(MappedFieldType.java:234)
    at org.elasticsearch.index.mapper.MappedFieldType.checkCompatibility(MappedFieldType.java:246)
    at org.elasticsearch.index.mapper.core.NumberFieldMapper$NumberFieldType.checkCompatibility(NumberFieldMapper.java:146)
    at org.elasticsearch.index.mapper.FieldTypeLookup.checkCompatibility(FieldTypeLookup.java:151)
    at org.elasticsearch.index.mapper.FieldTypeLookup.copyAndAddAll(FieldTypeLookup.java:115)
    at org.elasticsearch.index.mapper.MapperService.merge(MapperService.java:340)
    at org.elasticsearch.index.mapper.MapperService.merge(MapperService.java:289)
    at org.elasticsearch.cluster.metadata.MetaDataMappingService$PutMappingExecutor.applyRequest(MetaDataMappingService.java:303)
    at org.elasticsearch.cluster.metadata.MetaDataMappingService$PutMappingExecutor.execute(MetaDataMappingService.java:230)
    at org.elasticsearch.cluster.service.InternalClusterService.runTasksForExecutor(InternalClusterService.java:468)
    at org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:772)
    at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:231)
    at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:194)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Exception in thread "main" javax.ws.rs.WebApplicationException: HTTP 500 Internal Server Error
    at com.bighalf.bigpay.service.BillService.addBill(BillService.java:112)
    at com.bighalf.bigpay.controllerImpl.CompanyBillControllerImpl.addBill(CompanyBillControllerImpl.java:63)
    at com.bighalf.bigpay.controllerImpl.CompanyBillControllerImpl.main(CompanyBillControllerImpl.java:68)

我已经在同一个索引中保存了一个文档,它已被保存,并从第二个文档中抛出上述错误。

我想在同一个索引上执行搜索以及聚合,这就是为什么我有如上所述的映射。

请告诉我如何解决此问题。过去几天一直坚持这一点。

0 个答案:

没有答案