“查询”属性无意中添加在Elasticsearch映射中

时间:2015-03-06 19:43:50

标签: elasticsearch elasticsearch-mapping

我最近将我们的ElasticSearch服务器从0.9版更新到1.4版,当我为新ES导入Mapping时,我看到这是在映射中添加的:

"query": {
  "properties": {
    "match_all": {
      "type": "object"
     }
   }
 },

该代码段不在我导入的映射中,但在查询curl -X GET localhost:9200/my_index/_mapping?pretty时始终显示。

有没有人见过这个?

1 个答案:

答案 0 :(得分:1)

看起来你不小心创建了索引而不是查询它。 IE,你发布到:

POST http://localhost:9200/myindex -d '"query": {
  "properties": {
    "match_all": {
      "type": "object"
     }
   }
 }'

当您可能需要时,它将使用该映射创建索引:

POST http://localhost:9200/myindex/_search -d '"query": {
  "properties": {
    "match_all": {
      "type": "object"
     }
   }
 }'

只会搜索。