我怎么可以写一个查询来获取数据从略任基础上的地位?

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

GET/客户-uk/_search{"查询":{"bool":{的"必须":{"match_all":{}}"过滤":{"术语":{"状态":"不活跃"}}}}}我用这个但是没有输出
MADHUSUDAN RATNALU

你可以更新你的问题的结果,你会从 GET /customer-uk?
Val

我加入该文件可以通过它现在
MADHUSUDAN RATNALU

这不是我的要求,删除 _search 部的网址,只要索引中的名称,请:-)
Val

得到了以下errpor{"类型":"illegal_argument_exception","理由":"请求[GET/客户-fr]不支持具有身体"}
MADHUSUDAN RATNALU

删除体,只要运行 GET /customer-fr
Val

MADHUSUDAN RATNALU

其他语言

此页面有其他语言版本

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