कैसे कर सकते हैं मैं लिखने के लिए क्वेरी से डेटा लाने के लिए elasticsearch स्थिति पर आधारित?

0

सवाल

मैं करने के लिए चाहते हैं से डेटा लाने के लिए लोचदार के आधार पर खोज की स्थिति । यदि यह स्थिति है, सक्रिय/निष्क्रिय मैं लाने चाहते हैं डेटा की एक सूची.

मैं यहाँ संलग्न एक एकल रिकॉर्ड के लिए उदाहरण है । कैसे कर सकते हैं मैं यह मिलता है?

{
  "took": 2,
  "timed_out": false,
  "_shards": {
    "total": 2,
    "successful": 2,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 1,
      "relation": "eq"
    },
    "max_score": 1.0,
    "hits": [
      {
        "_index": "customer-fr",
        "_type": "_doc",
        "_id": "NFR0002220803",
        "_score": 1.0,
        "_source": {
          "customerManagedBy": "V",
          "numOfBeds": null,
          "legalEntity": null,
          "dependency": null,
          "credentials": [
            
          ],
          "affiliations": [
            {
              "endDate": "2010-06-08",
              "startDate": "2009-08-04",
              "parent": "NFR0002220803",
              "role": "Vice-Président",
              "relationShipType": "Travaille sur",
              "relationshipKey": "NFR0002220803|NFR0002217822|271568|2009-08-04",
              "isPrimary": false,
              "status": "In-Active",
              "child": "NFR0002217822",
              "isDuplicate": false
            },
            {
              "endDate": "2010-06-08",
              "startDate": "2009-08-04",
              "parent": "NFR0002220803",
              "role": "Vice-Président",
              "relationShipType": "Travaille sur",
              "relationshipKey": "NFR0002220803|NFR0002217823|271568|2009-08-04",
              "isPrimary": false,
              "status": "In-Active",
              "child": "NFR0002217823",
              "isDuplicate": false
            },
            {
              "endDate": "2010-06-08",
              "startDate": "2009-08-04",
              "parent": "NFR0002220803",
              "role": "Vice-Président",
              "relationShipType": "Travaille sur",
              "relationshipKey": "NFR0002220803|NFR0002217824|271568|2009-08-04",
              "isPrimary": false,
              "status": "In-Active",
              "child": "NFR0002217824",
              "isDuplicate": false
            },
            {
              "endDate": "2010-06-08",
              "startDate": "2009-08-04",
              "parent": "NFR0002220803",
              "role": "Vice-Président",
              "relationShipType": "Travaille sur",
              "relationshipKey": "NFR0002220803|NFR0002217825|271568|2009-08-04",
              "isPrimary": false,
              "status": "In-Active",
              "child": "NFR0002217825",
              "isDuplicate": false
            },
            {
              "endDate": "2010-06-08",
              "startDate": "2009-08-04",
              "parent": "NFR0002220803",
              "role": "Vice-Président",
              "relationShipType": "Travaille sur",
              "relationshipKey": "NFR0002220803|NFR0002217826|271568|2009-08-04",
              "isPrimary": false,
              "status": "In-Active",
              "child": "NFR0002217826",
              "isDuplicate": false
            }
          ],
          "@timestamp": "2021-11-11T06:49:57.704Z",
          "department": "Instances, Commissions",
          "dispensingFlag": null,
          "hcoType": "divers",
          "specialties": [
            {
              "speciality": "Conseil régional",
              "type": "Primary Specialty",
              "status": "Active"
            }
          ],
          "hcoSubType": "Institutions administratives et politiques",
          "technicalData": {
            "createdOn": "2021-10-19T17:15:46",
            "createdBy": "Techadmin Techadmin (techadmin)",
            "lastUpdateOn": "2021-11-08T15:04:01",
            "updatedBy": "Techadmin Techadmin (techadmin)"
          },
          "organizationName": "COMMISSION PERMANENTE",
          "customerAddresses": [
            {
              "region": "France Métropole",
              "stateOrProvince": "MOSELLE",
              "microBrick": null,
              "startDate": "2009-08-04",
              "addressLine3": null,
              "height": null,
              "addressKey": "NFR0002220803|AFR0000453829|200148|2009-08-04",
              "latitude": null,
              "brick": "57MET",
              "isPrimary": true,
              "addressId": "AFR0000453829",
              "countryName": "France",
              "endDate": "3999-12-31",
              "addressLine2": null,
              "longitude": null,
              "masterAddress": null,
              "addressLine1": "1 PLACE GABRIEL HOCQUARD",
              "postalCode": "57000",
              "addressType": "Primary address",
              "geoCoordinates": null,
              "status": "Active",
              "suburb": null,
              "city": "METZ"
            }
          ],
          "marketAccessFlag": null,
          "noOfPhysicians": null,
          "privacyLawStatus": false,
          "statusDetail": "Closed",
          "customerRecordType": "Health Care Organization",
          "identities": [
            {
              "effectiveDate": "2021-11-08T15:02:50",
              "value": "WFRH00000001",
              "type": "OneKey",
              "expirationDate": null
            }
          ],
          "topCustomerName": null,
          "@version": "1",
          "name": "COMMISSION PERMANENTE",
          "customerType": "Organization",
          "alias": null,
          "country": "France",
          "meansOfContact": [
            
          ],
          "status": "Inactive",
          "customerId": "NFR0002220803"
        }
      }
    ]
  }
}

इस क्वेरी मैं खोज करने की कोशिश की

GET /customer-fr/_search

{
  "query": {
    "bool": {
      "must": {
        "match_all": {
          
        }
      },
      "filter": {
        "bool": {
          "must": [
            {
              "status": "Inactive"
            }
          ]
        }
      }
    }
  }
elasticsearch kibana kibana-5 kibana-6
2021-11-22 05:43:28
1

सबसे अच्छा जवाब

1

आप एक की जरूरत नहीं है range क्वेरी के लिए । एक सरल term क्वेरी इस तरह से एक काम करना चाहिए:

{
  "query": {
    "bool": {
      "filter": {
        "term": {
          "status": "In-Active"
        }
      }
    }
  }
}
2021-11-22 05:46:16

प्राप्त /ग्राहक-ब्रिटेन/_search { "क्वेरी": { "bool": { "चाहिए":{ "match_all":{} }, "फिल्टर": { "शब्द": { "स्थिति": "निष्क्रिय" } } } } } मैं इस का इस्तेमाल किया लेकिन वहाँ कोई उत्पादन
MADHUSUDAN RATNALU

आप कर सकते हैं अद्यतन अपने सवाल परिणाम के साथ आप से मिल GET /customer-uk?
Val

मैं जोड़ा गया फ़ाइल आप कर सकते हैं के माध्यम से जाना है यह अब
MADHUSUDAN RATNALU

नहीं है कि मैं क्या कहा, निकालें _search भाग में URL, बस सूचकांक नाम, कृपया :-)
Val

नीचे errpor { "टाइप" : "illegal_argument_exception", "कारण" : "अनुरोध [मिलता है /ग्राहक fr] का समर्थन नहीं करता है एक शरीर" }
MADHUSUDAN RATNALU

शरीर को दूर, बस चलाने के लिए GET /customer-fr
Val

अन्य भाषाओं में

यह पृष्ठ अन्य भाषाओं में है

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................

इस श्रेणी में लोकप्रिय

लोकप्रिय सवाल इस श्रेणी में