Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道如何将每个调用的字段设置"location"为 type "geo_point"。
"location"
"geo_point"
我可以为此使用默认映射吗?如果是,我找不到任何例子。
还是我应该使用动态模板?
谢谢
您可以使用动态模板。以下是创建索引时如何执行此操作的示例:
curl -XPOST localhost:9200/test -d '{ "settings": { "number_of_shards": 1 }, "mappings": { "_default_:": { "_ttl": true, "dynamic_templates": [ { "geo_location": { "mapping": { "type": "geo_point" }, "match": "location" } } ] } } }'