gpt4 book ai didi

elasticsearch - 如何查询 Elasticsearch 自动完成字段,并仅返回某些结果?

转载 作者:行者123 更新时间:2023-12-03 01:04:15 26 4
gpt4 key购买 nike

给定以下映射:

{
"tags": {
"aliases": {},
"mappings": {
"tag": {
"properties": {
"_users": {
"type": "string"
},
"child": {
"type": "string"
},
"level": {
"type": "double"
},
"name": {
"type": "string",
"fields": {
"suggest": {
"type": "completion",
"analyzer": "simple",
"payloads": true,
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50
}
}
},
"parent": {
"type": "string"
},
"root": {
"type": "boolean"
}
}
}
},
"settings": {
"index": {
"creation_date": "1443688314495",
"number_of_shards": "5",
"number_of_replicas": "1",
"version": {
"created": "1070299"
},
"uuid": "iH0QRRm_QF6pXEZ5sJI4yA"
}
},
"warmers": {}
}
}

另外, _users是一个字符串数组。

如何查询标签名称建议,并仅返回在 _users数组中查询“id”的文档?

这是一个示例标记:
{
"_index": "tags",
"_type": "tag",
"_id": "560b25d8276a6504d808d703",
"_score": 1.0,
"_source": {
"name": "elastic indexed?",
"child": [],
"_users": ["foobar", "someMongoObjectID", "hellothere"],
"_id": "560b25d8276a6504d808d703"
}
}

最佳答案

查看Context Suggester是否可以满足您的需求。

关于elasticsearch - 如何查询 Elasticsearch 自动完成字段,并仅返回某些结果?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32883407/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com