基于属性的弹性搜索中通过吞食检索索引的文档。
我是弹性搜索的新手,我想用一些属性索引文件,比如作者,标题,主题,类别,社区等等。
我达到了多远:-
我能够创建一个附件管道,并能够在具有属性的弹性中摄取不同的文档。以下是我的表现:-
1)根据下列请求创建管道:
{
"description":"Extract attachment information",
"processors":[
{
"attachment":{
"field":"data"
}
}
]
}2)通过下列代码上传附件:
{
"filename":"Presentations-Tips.ppt",
"Author":"Jaspreet",
"Category":"uploading ppt",
"Subject":"testing ppt",
"fileUrl":"",
"attributes":
{"attr11":"attr11value","attr22":"attr22value","attr33":"attr33value"},
"data": "here_base64_string_of_file"
}3)然后可以自由搜索上述所有属性和文件内容:
{
"query":{
"query_string":{
"query":"*test*"
}
}
}现在我想要的是:-想通过一些过滤器缩小搜索范围,比如:-
请帮助我使用正确的查询语法,并调用url进行上述全文搜索,我使用了“GET/my_index/_ search”。
发布于 2019-02-13 17:21:59
经过一段时间终于得到了答案:-
curl -X POST \
http://localhost:9200/my_index/_search \
-H 'Content-Type: application/json' \
-d '{
"query": {
"bool": {
"must": [
{
"query_string": {
"query": "progress"
}
},
{
"wildcard": {
"Author": "Rohan"
}
},
{
"wildcard": {
"Title": "q*"
}
}
]
}
}
}'在上面,您可以根据需要删除或添加必须数组中的任何对象。
https://stackoverflow.com/questions/54644110
复制相似问题