1

谁能帮忙?

查询作为分隔的“匹配查询”和“范围查询”成功运行,但运行时出现错误

这是我的查询,但我无法得到结果:

GET composition_value/composition/_count
{

  "query": {
    "nested": {
      "path": "value",
      "query": {
        "match": {
          "value.composition.content.data.events.data.items.name.value": "systolic"
        }, 
        "range": {
          "value.composition.content.data.events.data.items.value.magnitude": {
            "gte": 10,
            "lte": 99
          }
        }   
      }

    }
  }

}

这是错误,查询的结果:

{
  "error": {
    "root_cause": [
      {
        "type": "parsing_exception",
        "reason": "[match] malformed query, expected [END_OBJECT] but found [FIELD_NAME]",
        "line": 10,
        "col": 9
      }
    ],
    "type": "parsing_exception",
    "reason": "[match] malformed query, expected [END_OBJECT] but found [FIELD_NAME]",
    "line": 10,
    "col": 9
  },
  "status": 400
}

已编辑

问题是我只想在“收缩”中提交“幅度”而不是其他

这是我搜索的主要文档:

  {
    "composition": {
        "name": {
            "value": "Avaexample1"
        },
        "archetype_details": {
            "archetype_id": {
                "value": "openEHR-EHR-COMPOSITION.avaexample1.v0"
            },
            "template_id": {
                "value": "New Template"
            },
            "rm_version": "1.0.2"
        },
        "language": {
            "terminology_id": {
                "value": "ISO_639-1"
            },
            "code_string": "en"
        },
        "territory": {
            "terminology_id": {
                "value": "ISO_3166-1"
            },
            "code_string": "UY"
        },
        "category": {
            "value": "event",
            "defining_code": {
                "terminology_id": {
                    "value": "openehr"
                },
                "code_string": "433"
            }
        },
        "composer": {
            "external_ref": {
                "id": {
                    "value": "ecd01eaf-775a-43c9-8b4b-1a9ba0257568",
                    "_xsi:type": "HIER_OBJECT_ID"
                },
                "namespace": "DEMOGRAPHIC",
                "type": "PERSON"
            },
            "name": "Dr. Yamamoto",
            "_xsi:type": "PARTY_IDENTIFIED"
        },
        "context": {
            "start_time": {
                "value": "20170723T122153,184+0430"
            },
            "setting": {
                "value": "Hospital B",
                "defining_code": {
                    "terminology_id": {
                        "value": "openehr"
                    },
                    "code_string": "229"
                }
            }
        },
        "content": {
            "name": {
                "value": "Blood pressure"
            },
            "language": {
                "terminology_id": {
                    "value": "ISO_639-1"
                },
                "code_string": "en"
            },
            "encoding": {
                "terminology_id": {
                    "value": "Unicode"
                },
                "code_string": "UTF-8"
            },
            "subject": {
                "_xsi:type": "PARTY_SELF"
            },
            "protocol": {
                "name": {
                    "value": "list structure"
                },
                "items": [{
                    "name": {
                        "value": "Cuff size"
                    },
                    "value": {
                        "value": "Adult Thigh",
                        "defining_code": {
                            "terminology_id": {
                                "value": "local"
                            },
                            "code_string": "at0015"
                        },
                        "_xsi:type": "DV_CODED_TEXT"
                    },
                    "_archetype_node_id": "at0013",
                    "_xsi:type": "ELEMENT"
                },
                {
                    "name": {
                        "value": "Location"
                    },
                    "items": [{
                        "name": {
                            "value": "Non-invasive locations"
                        },
                        "value": {
                            "value": "Right arm",
                            "defining_code": {
                                "terminology_id": {
                                    "value": "local"
                                },
                                "code_string": "at0025"
                            },
                            "_xsi:type": "DV_CODED_TEXT"
                        },
                        "_archetype_node_id": "at0014.1",
                        "_xsi:type": "ELEMENT"
                    },
                    {
                        "name": {
                            "value": "Intra-arterial locations"
                        },
                        "value": {
                            "value": "Radial Left",
                            "defining_code": {
                                "terminology_id": {
                                    "value": "local"
                                },
                                "code_string": "at0.1059"
                            },
                            "_xsi:type": "DV_CODED_TEXT"
                        },
                        "_archetype_node_id": "at0.1058",
                        "_xsi:type": "ELEMENT"
                    },
                    {
                        "name": {
                            "value": "Specific location"
                        },
                        "value": {
                            "value": "UzuefCsHBYVwKK,WzicypjaKpjqHAw",
                            "defining_code": {
                                "terminology_id": {
                                    "value": "terminology_not_specified_as_constraint_or_referenceSetUri_in_opt"
                                },
                                "code_string": "1002779"
                            },
                            "_xsi:type": "DV_CODED_TEXT"
                        },
                        "_archetype_node_id": "at1034",
                        "_xsi:type": "ELEMENT"
                    }],
                    "_archetype_node_id": "at1033",
                    "_xsi:type": "CLUSTER"
                },
                {
                    "name": {
                        "value": "Method"
                    },
                    "value": {
                        "value": "Auscultation",
                        "defining_code": {
                            "terminology_id": {
                                "value": "local"
                            },
                            "code_string": "at1036"
                        },
                        "_xsi:type": "DV_CODED_TEXT"
                    },
                    "_archetype_node_id": "at1035",
                    "_xsi:type": "ELEMENT"
                },
                {
                    "name": {
                        "value": "Mean Arterial Pressure Formula"
                    },
                    "value": {
                        "value": "jErCuglJdkV,KjmPwC.xxwoGTikkIprmZwVyTrfZIrm  WCzMcIaQG MkLOeqjFbDVJxQZYLWyZgiIszVuyytmxdOIFsdPTxyz jct.SqjOedXuxSl REmuIrUnpMuqgIZaZIapQVHDoPvnQSivESJPTOptqDxAxwVpTJKIAL ldtMyUOWj,ym,AYZTzJugWFhLOdkJXhTFewmHSRBFwKEouqMVPgbnmrTzfLNoncDDgpuBPCrdyojWM.UMKuqe",
                        "_xsi:type": "DV_TEXT"
                    },
                    "_archetype_node_id": "at1038",
                    "_xsi:type": "ELEMENT"
                },
                {
                    "name": {
                        "value": "Diastolic endpoint"
                    },
                    "value": {
                        "value": "Phase IV",
                        "defining_code": {
                            "terminology_id": {
                                "value": "local"
                            },
                            "code_string": "at1011"
                        },
                        "_xsi:type": "DV_CODED_TEXT"
                    },
                    "_archetype_node_id": "at1010",
                    "_xsi:type": "ELEMENT"
                },
                {
                    "name": {
                        "value": "Suitable for graphing?"
                    },
                    "value": {
                        "value": "true",
                        "_xsi:type": "DV_BOOLEAN"
                    },
                    "_archetype_node_id": "at0.1054",
                    "_xsi:type": "ELEMENT"
                }],
                "_archetype_node_id": "at0011",
                "_xsi:type": "ITEM_TREE"
            },
            "data": {
                "name": {
                    "value": "history"
                },
                "origin": {
                    "value": "20170723T122153,605+0430",
                    "_xsi:type": "DV_DATE_TIME"
                },
                "events": {
                    "name": {
                        "value": "any event"
                    },
                    "time": {
                        "value": "20170723T122153,621+0430",
                        "_xsi:type": "DV_DATE_TIME"
                    },
                    "data": {
                        "name": {
                            "value": "blood pressure"
                        },
                        "items": [{
                            "name": {
                                "value": "Systolic"
                            },
                            "value": {
                                "magnitude": "70",
                                "units": "cm[Hg]",
                                "_xsi:type": "DV_QUANTITY"
                            },
                            "_archetype_node_id": "at0004",
                            "_xsi:type": "ELEMENT"
                        },
                        {
                            "name": {
                                "value": "Diastolic"
                            },
                            "value": {
                                "magnitude": "80",
                                "units": "cm[Hg]",
                                "_xsi:type": "DV_QUANTITY"
                            },
                            "_archetype_node_id": "at0005",
                            "_xsi:type": "ELEMENT"
                        },
                        {
                            "name": {
                                "value": "Mean Arterial Pressure"
                            },
                            "value": {
                                "magnitude": "615",
                                "units": "mm[Hg]",
                                "_xsi:type": "DV_QUANTITY"
                            },
                            "_archetype_node_id": "at1006",
                            "_xsi:type": "ELEMENT"
                        },
                        {
                            "name": {
                                "value": "Pulse Pressure"
                            },
                            "value": {
                                "magnitude": "324",
                                "units": "mm[Hg]",
                                "_xsi:type": "DV_QUANTITY"
                            },
                            "_archetype_node_id": "at1007",
                            "_xsi:type": "ELEMENT"
                        },
                        {
                            "name": {
                                "value": "Comment"
                            },
                            "value": {
                                "value": "QppbwmXaKavNSNXmIpkSADyBZ,eFLKjwUomBscVAPHzWQLNTMkvcokamY,NFbcrmLNAlxn.hmpTHRjRNNcIhwfQJUpBpzVohQvoukpZb.ezPmOCcHQNVTcmHeMVShPvMtMFeSXrMeHZstnmikelrCWGMGDEwBKvAabKWDDotsfbMGpETL oifeUyxUxOGFmhwwgDkAjifomZXm.yCIEitsahimjwLwyZyXyOqrJnqcyhNvbhwUwUQtTqeOUiTtm",
                                "_xsi:type": "DV_TEXT"
                            },
                            "_archetype_node_id": "at0033",
                            "_xsi:type": "ELEMENT"
                        }],
                        "_archetype_node_id": "at0003",
                        "_xsi:type": "ITEM_TREE"
                    },
                    "state": {
                        "name": {
                            "value": "state structure"
                        },
                        "items": [{
                            "name": {
                                "value": "Position"
                            },
                            "value": {
                                "value": "Standing",
                                "defining_code": {
                                    "terminology_id": {
                                        "value": "local"
                                    },
                                    "code_string": "at1000"
                                },
                                "_xsi:type": "DV_CODED_TEXT"
                            },
                            "_archetype_node_id": "at0008",
                            "_xsi:type": "ELEMENT"
                        },
                        {
                            "name": {
                                "value": "Confounding factors"
                            },
                            "value": {
                                "value": ",dUW hFmdIEDsQN ifxzaVoIUXcwrI,bRnmIWpd udD,,HWqrLzDpaybOKgXWNNCZgjACXlKNUQCIXpWgMUWumXo oNWATIhPe BBb,GxdciYgTfMEpeHtiuV,DfESmNFOxWANjyskrgWhANaViKHcSyHfUVdPiTfFi.,XPSrJamSCfUrOYHBO,axGQenCnGrdFEHlPNxc RwzAUzjwRdNAdOqVAYmFoVkPLlhjgajECMYXfoTqrYKtTP.BiIpo",
                                "_xsi:type": "DV_TEXT"
                            },
                            "_archetype_node_id": "at1052",
                            "_xsi:type": "ELEMENT"
                        },
                        {
                            "name": {
                                "value": "Sleep status"
                            },
                            "value": {
                                "value": "Alert & awake",
                                "defining_code": {
                                    "terminology_id": {
                                        "value": "local"
                                    },
                                    "code_string": "at1044"
                                },
                                "_xsi:type": "DV_CODED_TEXT"
                            },
                            "_archetype_node_id": "at1043",
                            "_xsi:type": "ELEMENT"
                        },
                        {
                            "name": {
                                "value": "Tilt"
                            },
                            "value": {
                                "magnitude": "-72",
                                "units": "",
                                "_xsi:type": "DV_QUANTITY"
                            },
                            "_archetype_node_id": "at1005",
                            "_xsi:type": "ELEMENT"
                        }],
                        "_archetype_node_id": "at0007",
                        "_xsi:type": "ITEM_TREE"
                    },
                    "_archetype_node_id": "at0006",
                    "_xsi:type": "POINT_EVENT"
                },
                "_archetype_node_id": "at0001",
                "_xsi:type": "HISTORY"
            },
            "_archetype_node_id": "openEHR-EHR-OBSERVATION.blood_pressure-zn.v1",
            "_xsi:type": "OBSERVATION"
        },
        "_xmlns": "http://schemas.openehr.org/v1",
        "_xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
        "_archetype_node_id": "openEHR-EHR-COMPOSITION.avaexample1.v0"
    }
}
4

1 回答 1

1

如此处所述,试试这个:

 {
  "query": {
    "nested": {
      "path": "value",
      "query": {
        "bool": {
          "must": [
            {
              "match": {
                "value.composition.content.data.events.data.items.name.value": "systolic"
              }
            },
            {
              "range": {
                "value.composition.content.data.events.data.items.value.magnitude": {
                  "gte": 10,
                  "lte": 99
                }
              }
            }
          ]
        }
      }
    }
  }
}
于 2017-09-24T09:38:11.220 回答