从Elasticsearch检索数据时,请删除停止字或排除列表
- 我需要删除停止单词和一些单词以排除以搜索
- 如果我在搜索喜剧时,我不应该在排除列表中获得任何内容,我在
- 停止词中添加 了喜剧无论我进行正常搜索,都应匹配
- ,我应该返回存在的值。就像im搜索
jennifer
- 现在,如果im搜索
和
im for uptuff现在,停止词对我不起作用,但是我不应该 - 使用
query> query_string < /code>仅在我的DSL查询
[{'ID':0,'title':'live1','us gross':146083,'Worldwide Gross':146083,'US DVD销售':无,'生产预算':8000000,“发布日期”:“ 1998年6月12日”,'mpaa评级':'r',“运行时间min”:note类型':喜剧,“创意类型”:无,'导演':T and I,“腐烂的西红柿评级”:无,'imdb评级':6.1,'imdb票':1071},{'id'':1 ,, 1 ,, 1 ,, 1 ,, “标题”:“初恋,最后的礼仪”,“美国总体”:10876,“全球票房”:10876,'US DVD销售':无,“生产预算”:300000,“发布日期”:'8月7日1998年8月7日','mpaa rating':'r','running timer min':none,“分销商”:'strand',“ source':none,“主要类型”:“戏剧”,“创意类型”:none,none,'导演':理查德·詹妮弗(Richard Jennifer),“腐烂的西红柿等级”:无,'imdb评分':6.9,'imdb票':207}]
设置在
settings = {
"settings": {
"analysis": {
"analyzer": {
"blogs_analyzer": {
"type": "standard",
"stopwords": ["and", "is","comedy"]
}
}
}
}
}
我的DSL查询下方,在下面
{
"query": {
"bool": {
"must": {
"query_string": {
"query": "and",
"fields": ["Title^24",
"Major Genre^8","Director^2" ]
}
}
}
}}
- I need to remove stop words and some words to exclude to search
- if i m searching for comedy i should not get anything since its in exclusion list, i have added comedy in stopwords
- what word i have added in stop words then i should not get that if it's matches irrespective of
- if i am doing normal search then i should return the values present. like if i m searching for
Jennifer
- RIght now stopwords is not working for me, if i m searching
and
i m getting output, but i should not - I have to use
query_string
only in my dsl query
[ { 'id': 0, 'Title': 'Live1', 'US Gross': 146083, 'Worldwide Gross': 146083, 'US DVD Sales': None, 'Production Budget': 8000000, 'Release Date': 'Jun 12 1998', 'MPAA Rating': 'R', 'Running Time min': None, 'Distributor': 'Gramercy', 'Source': None, 'Major Genre': Comedy, 'Creative Type': None, 'Director': T and I, 'Rotten Tomatoes Rating': None, 'IMDB Rating': 6.1, 'IMDB Votes': 1071 }, { 'id': 1, 'Title': 'First Love, Last Rites', 'US Gross': 10876, 'Worldwide Gross': 10876, 'US DVD Sales': None, 'Production Budget': 300000, 'Release Date': 'Aug 07 1998', 'MPAA Rating': 'R', 'Running Time min': None, 'Distributor': 'Strand', 'Source': None, 'Major Genre': 'Drama', 'Creative Type': None, 'Director': Richard Jennifer, 'Rotten Tomatoes Rating': None, 'IMDB Rating': 6.9, 'IMDB Votes': 207 }]
settings is below
settings = {
"settings": {
"analysis": {
"analyzer": {
"blogs_analyzer": {
"type": "standard",
"stopwords": ["and", "is","comedy"]
}
}
}
}
}
My Dsl query is below
{
"query": {
"bool": {
"must": {
"query_string": {
"query": "and",
"fields": ["Title^24",
"Major Genre^8","Director^2" ]
}
}
}
}}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
似乎您已经创建了
blogs_analyzer
,但没有分配到任何字段。因此,它将考虑标准分析仪。您需要使用下面的配置创建索引映射,然后不会给您带来结果:
上述配置后,可以重新索引数据并使用以下查询搜索:
It seems like you have created
blogs_analyzer
but not assign to any of the field. So it will consider standard analyzer.You need to create index mapping with below configuration and then it will not give you result:
After above configuration, you can reindex your data and search with below query: