我可以使用NodeJS Elastcsearch lib(https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/quick-start.html)进行搜索。
是否可以对索引执行原始查询?我可以执行以下命令吗?
PUT index
{
"settings": {
"analysis": {
"normalizer": {
"my_normalizer": {
"type": "custom",
"char_filter": [],
"filter": ["lowercase", "asciifolding"]
}
}
}
},
"mappings": {
"_doc": {
"properties": {
"foo": {
"type": "keyword",
"normalizer": "my_normalizer"
}
}
}
}
}
...就像使用Kibana一样以JSON格式获取结果。这可能吗?
答案 0 :(得分:1)
您可以使用 indices.create
client.indices.create([params, [callback]])
示例
client.indices.create({
index: "persons",
body: {
"settings" : {
"number_of_shards" : 1
},
"mappings" : {
"type1" : {
"properties" : {
"field1" : { "type" : "text" }
}
}
}
}
})
检查文档indices.create