2 個答案
- 最新
- 最多得票
- 最多評論
0
UPDATE: I changed my code to what is below, but it is too restrictive and only returns records that have both the category and play flelds. I need it to return records if both or either field exist.
{
"version":"2017-02-28",
"operation":"GET",
"path":"/articlesnew1/json/_search",
"params":{
"body": {
"size": 50,
"query": {
"bool": {
"should" : [
{
"terms" : {
"field_categories.__target_path" : ["he/taxonomy_term/categories/837","he/taxonomy_term/categories/840","he/taxonomy_term/categories/841","he/taxonomy_term/categories/842"]
}
},
{
"terms" : {
"field_plays.__target_path" : ["he/taxonomy_term/plays/757","he/taxonomy_term/plays/758","he/taxonomy_term/plays/759","he/taxonomy_term/plays/761","he/taxonomy_term/plays/762","he/taxonomy_term/plays/763","he/taxonomy_term/plays/764"]
}
}
],
"must_not": [
{
"term": {
"field_exclude_from_syndication.value": 1
}
}
],
"must": [
{
"bool": {
"should" : [{
"exists": {
"field" : "field_categories.__target_path"
},
"exists": {
"field" : "field_plays.__target_path"
}
}]
}
}
],
"filter": [
{
"terms": {
"entity.bundle" : ["he_activity_highlight","he_company","he_event","he_exclusive","he_industry_voice","he_new_financing","he_news","he_opinion","he_person","he_publication","he_transaction","he_under_40","he_whos_who"]
}
},
{
"range" : {
"entity.changed.timestamp" : {
"gte": "${context.arguments.from}",
"lte": "${context.arguments.to}"
}
}
}
]
}
}
}
}
}
Ideas?
Edited by: cjokinen on Jun 11, 2019 9:33 AM
Edited by: cjokinen on Jun 11, 2019 9:34 AM
已回答 5 年前
0
I found the answer in that I missed some curly braces inside of the must section....
{
"version":"2017-02-28",
"operation":"GET",
"path":"/articlesnew1/json/_search",
"params":{
"body": {
"size": 50,
"query": {
"bool": {
"should" : [
{
"terms" : {
"field_categories.__target_path" : ["he/taxonomy_term/categories/837","he/taxonomy_term/categories/840","he/taxonomy_term/categories/841","he/taxonomy_term/categories/842"]
}
},
{
"terms" : {
"field_plays.__target_path" : ["he/taxonomy_term/plays/757","he/taxonomy_term/plays/758","he/taxonomy_term/plays/759","he/taxonomy_term/plays/761","he/taxonomy_term/plays/762","he/taxonomy_term/plays/763","he/taxonomy_term/plays/764"]
}
}
],
"must_not": [
{
"term": {
"field_exclude_from_syndication.value": 1
}
}
],
"must": [
{
"bool": {
"should" : [{
"exists": {
"field" : "field_categories.__target_path"
}
},
{
"exists": {
"field" : "field_plays.__target_path"
}
}]
}
}
],
"filter": [
{
"terms": {
"entity.bundle" : ["he_activity_highlight","he_company","he_event","he_exclusive"]
}
},
{
"range" : {
"entity.changed.timestamp" : {
"gte": "${context.arguments.from}",
"lte": "${context.arguments.to}"
}
}
}
]
}
}
}
}
}
Edited by: cjokinen on Jun 11, 2019 1:21 PM
已回答 5 年前
相關內容
- 已提問 6 個月前
- AWS 官方已更新 2 年前
- AWS 官方已更新 1 年前