具有两个短语的多短语方法 - Elastic Search
multiphrase method with two phrases - Elastic Search
我有一段说
Lorem Ipsum is simply dummy text of the printing and typesetting
industry. Lorem Ipsum has been the industry's standard dummy text ever
since the 1500s, when an unknown printer took a galley of type and
scrambled it to make a type specimen book. It has survived not only
five centuries, but also the leap into electronic typesetting,
remaining essentially unchanged.
现在我想为这个段落使用两个短语的匹配短语。
1.simply dummy text of the printing
2.make a type specimen book
Elastic 搜索查询应该检查这两个短语是否都出现在段落和 return 答案中。我怎样才能做到这一点?
提前致谢。
我对代码的看法:
{
"query": {
"match_phrase": {
"paragraph": {
"query": {"simply dummy text of the printing","make a type specimen book"}
}
}
}
}
这是正确的做法吗??
"AND" 种条件:
{
"query": {
"bool": {
"must": [
{
"match_phrase": {
"paragraph": "simply dummy text of the printing"
}
},
{
"match_phrase": {
"paragraph": "make a type specimen book"
}
}
]
}
}
}
"OR" 种条件:
{
"query": {
"bool": {
"should": [
{
"match_phrase": {
"paragraph": "simply dummy text of the printing"
}
},
{
"match_phrase": {
"paragraph": "make a type specimen book"
}
}
]
}
}
}
我有一段说
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
现在我想为这个段落使用两个短语的匹配短语。
1.simply dummy text of the printing
2.make a type specimen book
Elastic 搜索查询应该检查这两个短语是否都出现在段落和 return 答案中。我怎样才能做到这一点?
提前致谢。
我对代码的看法:
{
"query": {
"match_phrase": {
"paragraph": {
"query": {"simply dummy text of the printing","make a type specimen book"}
}
}
}
}
这是正确的做法吗??
"AND" 种条件:
{
"query": {
"bool": {
"must": [
{
"match_phrase": {
"paragraph": "simply dummy text of the printing"
}
},
{
"match_phrase": {
"paragraph": "make a type specimen book"
}
}
]
}
}
}
"OR" 种条件:
{
"query": {
"bool": {
"should": [
{
"match_phrase": {
"paragraph": "simply dummy text of the printing"
}
},
{
"match_phrase": {
"paragraph": "make a type specimen book"
}
}
]
}
}
}