弹性搜索找不到这个词

时间:2017-02-17 23:02:44

标签: elasticsearch

我已经在elasticsearch中加载了一些数据,并验证了它已被编入索引:

curl -XGET http://localhost:9200/studies/gov/NCT02953782
{"_index":"studies","_type":"gov","_id":"NCT02953782","_version":5,"found":true,"_source":{"status": "Recruiting", "is_fda_regulated": false, "description": "", "open_study_countries": ["United States"], "phase": "Phase 1/Phase 2", "completion_date": "2018-05-01", "references": [], "is_drug_intervention": true, "keywords": ["Colorectal Neoplasms, Hu5F9-G4, CD47, cetuximab"], "id": "NCT02953782", "title": "Trial of Hu5F9-G4 in Combination With Cetuximab in Patients With Solid Tumors and Advanced Colorectal Cancer", "summary": " This trial will evaluate Hu5F9-G4 in combination with cetuximab. Hu5F9-G4 is a monoclonal antibody which is designed to block a protein called CD47, which is widely expressed on human cancer cells. Blocking CD47 with Hu5F9-G4 may enable the body's immune system to find and destroy the cancer cells. Cetuximab is a monoclonal antibody drug that is used for treatment of certain types of colorectal cancer as well as head and neck cancer.\n The major aims of the study are: (Phase 1b) to define the safety profile and to determine a recommended Phase 2 dose for Hu5F9-G4 in combination with cetuximab, and (Phase 2) to evaluate the objective response rate of Hu5F9-G4 in combination with cetuximab in patients with advanced colorectal cancer. ", "first_received_date": "2016-11-01", "inclusion_criteria": " - Histological Diagnosis - Phase 1b only: Advanced solid malignancy with an emphasis on colorectal, head and neck, breast, pancreatic and ovarian cancers who have been treated with at least one regimen of prior systemic therapy, or who refuse systemic therapy, and for which there is no curative therapy available. - Phase 2: - KRAS Mutant CRC: Advanced KRAS mutant CRC who have progressed or are ineligible for both irinotecan and oxaliplatin based chemotherapy - KRAS Wild Type CRC: Advanced KRAS wild type CRC who have progressed or are ineligible for both irinotecan and oxaliplatin based chemotherapy and who are relapsed or refractory to at least 1 prior systemic therapy that included an anti-EGFR antibody, such as cetuximab, panitumumab or others. - Adequate performance status and hematological, liver, and kidney function - Phase 2 only: Willing to consent to 1 mandatory pre-treatment and 1 on-treatment tumor biopsy ", "exclusion_criteria": " - Active brain metastases - Prior treatment with CD47 or signal regulatory protein alpha (SIRPα) targeting agents. - Phase 2 only: second malignancy within the last 3 years. - Known active or chronic hepatitis B or C infection or HIV - Pregnancy or active breastfeeding", "start_date": "2016-11-01"}}

当我使用简单的查询搜索在其中搜索单词时,它找不到它:

curl -XPOST http://localhost:9200/studies/_search?pretty=true -d '{
  "query": {
    "simple_query_string" : {
        "query": "Colorectal",
        "analyzer": "snowball"
    }
  }
}'
{
  "took" : 1,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : 0,
    "max_score" : null,
    "hits" : [ ]
  }
}

有谁知道如何让它发挥作用?

1 个答案:

答案 0 :(得分:2)

simple_query_string queryquery_string query一样,针对index.query.default_field索引设置执行,默认设置为_all。默认情况下,使用Standard Analyzer分析_all字段。

您要求查询使用Snowball Analyzer,这可能不是您在索引时使用的内容。

如果您真的不需要雪球分析仪,您可以让您的查询使用标准分析仪。

相反,如果你真的想要使用雪球分析器,你应该在开始索引文档之前为_all字段添加mapping,但是请确保你没有打破任何其他查询如此。

这就是你如何将雪球分析器放在gov类型studies索引的映射中:

curl -XPUT http://localhost:9200/studies/_mapping/gov -d'{
  "_all": {
    "analyzer": "snowball"
  }
}'

之后,您需要再次索引文档。