elasticsearch,Curl,elasticsearch" /> elasticsearch,Curl,elasticsearch" />

Elasticsearch:在以同一单词开头的多个索引上使用curl-XPUT命令

Elasticsearch:在以同一单词开头的多个索引上使用curl-XPUT命令,curl,elasticsearch,Curl,elasticsearch,我想在名为index1-%{+YYYY.MM.dd}的几个索引上运行以下脚本: curl -XPUT http://localhost:9200/index1* -d ' { "mappings" : { "index1" : { "properties" : { "location": { "type": "geo_point" } }

我想在名为
index1-%{+YYYY.MM.dd}
的几个索引上运行以下脚本:

curl -XPUT http://localhost:9200/index1* -d '
{
    "mappings" : {
      "index1" : {
        "properties" : {
            "location": {
                "type": "geo_point"
               }
            }
        }
    }
}'
但是由于
“*”
,前面的脚本无法工作

你知道怎么解决这个问题吗


关于

您需要调用映射端点,因为索引index1*已经存在:

curl -XPUT http://localhost:9200/index1*/_mapping/index1 -d '{
    "properties" : {
        "location": {
            "type": "geo_point"
        }
    }
}'

您需要调用
\u映射
端点,因为索引
index1*
已经存在:

curl -XPUT http://localhost:9200/index1*/_mapping/index1 -d '{
    "properties" : {
        "location": {
            "type": "geo_point"
        }
    }
}'

是否要将相同的映射放置到所有索引

如果是,您可以创建一个模板。并将index1*放入其中,这样它将适用于以index1开头的所有索引

    curl -XPUT http://localhost:9200/_template/template_name -d '
{
  "template": "index1*",
  "settings": {
    ....
  },
  "mappings" : {
    "name_mapping" : {
      "properties" : {
        "geometry" : {
          "type":"geo_shape",
          "tree":"quadtree",
          "precision":"1m"
        },
        ...

是否要将相同的映射放置到所有索引

如果是,您可以创建一个模板。并将index1*放入其中,这样它将适用于以index1开头的所有索引

    curl -XPUT http://localhost:9200/_template/template_name -d '
{
  "template": "index1*",
  "settings": {
    ....
  },
  "mappings" : {
    "name_mapping" : {
      "properties" : {
        "geometry" : {
          "type":"geo_shape",
          "tree":"quadtree",
          "precision":"1m"
        },
        ...

好的一点,请注意,这不会修改现有的索引,但只适用于未来的索引。要修改现有索引,请使用另一个答案。好的一点是,这不会修改现有索引,但只适用于未来的索引。要修改现有索引,请使用其他答案。