我正在使用Symfony 2.8。我目前遇到此错误。我尝试通过运行app/console fos:elastic:populate
卸载并重新安装elasticsearch并再次填充集群。它们都不能解决问题。这是我的代码。
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
indexes:
website:
types:
blog:
mappings:
title: ~
content: ~
#description: ~
#category: ~
persistence:
driver: orm
model: CC\BlogBundle\Entity\BlogPost
provider: ~
listener:
immediate: ~
finder: ~
job:
mappings:
position: ~
location: ~
description: ~
category: ~
persistence:
driver: orm
model: CC\JobBundle\Entity\Job
provider: ~
listener: ~
# immediate: ~
finder: ~
care_recipient:
mappings:
zip: {index: not_analyzed}
type: {index: not_analyzed}
startDate:
{ "type": "date", "format": "MM/dd/yyyy" }
endDate:
{ "type": "date", "format": "MM/dd/yyyy" }
prefSmoke: {index: not_analyzed}
prefLicense: {index: not_analyzed}
prefInsurance: {index: not_analyzed}
prefPets: {index: not_analyzed}
payment:
type: "nested"
properties:
label: {index: not_analyzed}
prefHourlyRate: {index: not_analyzed}
prefDay:
type: "nested"
properties:
label: {index: not_analyzed}
availability:
type: "nested"
properties:
prefDay: {index: not_analyzed}
morning: {index: not_analyzed}
afternoon: {index: not_analyzed}
evening: {index: not_analyzed}
zipCode:
type: "nested"
properties:
label: {index: not_analyzed}
prefLocation: {index: not_analyzed}
# prefLocation:
# type: "nested"
# properties:
# label: {index: not_analyzed}
prefExperience:
type: "nested"
properties:
label: {index: not_analyzed}
prefLiftWeight:
type: "nested"
properties:
label: {index: not_analyzed}
prefFaith:
type: "nested"
properties:
label: {index: not_analyzed}
prefLanguage:
type: "nested"
properties:
label: {index: not_analyzed}
prefActivity:
type: "nested"
properties:
label: {index: not_analyzed}
prefNonMedical:
type: "nested"
properties:
label: {index: not_analyzed}
prefTitle:
type: "nested"
properties:
label: {index: not_analyzed}
persistence:
driver: orm
model: CC\UserBundle\Entity\CareRecipient
provider: ~
listener: ~
# immediate: ~
finder: ~
care_provider:
mappings:
firstName: {index: not_analyzed}
lastName: {index: not_analyzed}
city: {index: not_analyzed}
state: {index: not_analyzed}
zip: {index: not_analyzed}
type: {index: not_analyzed}
startDate:
{ "type": "date", "format": "MM/dd/yyyy" }
endDate:
{ "type": "date", "format": "MM/dd/yyyy" }
prefSmoke: {index: not_analyzed}
allergyCat: {index: not_analyzed}
allergyDog: {index: not_analyzed}
isLicensed: {index: not_analyzed}
isInsured: {index: not_analyzed}
payment:
type: "nested"
properties:
label: {index: not_analyzed}
prefHourlyRate: {index: not_analyzed}
prefDay:
type: "nested"
properties:
label: {index: not_analyzed}
availability:
type: "nested"
properties:
prefDay: {index: not_analyzed}
morning: {index: not_analyzed}
afternoon: {index: not_analyzed}
evening: {index: not_analyzed}
prefLocation:
type: "nested"
properties:
label: {index: not_analyzed}
prefExperience:
type: "nested"
properties:
label: {index: not_analyzed}
prefLiftWeight:
type: "nested"
properties:
label: {index: not_analyzed}
prefFaith:
type: "nested"
properties:
label: {index: not_analyzed}
prefLanguage:
type: "nested"
properties:
label: {index: not_analyzed}
prefActivity:
type: "nested"
properties:
label: {index: not_analyzed}
prefNonMedical:
type: "nested"
properties:
label: {index: not_analyzed}
prefTitle:
type: "nested"
properties:
label: {index: not_analyzed}
persistence:
driver: orm
model: CC\UserBundle\Entity\CareProvider
provider: ~
listener: ~
# immediate: ~
finder: ~
现在这是错误:
Uncaught PHP Exception Elastica\Exception\ResponseException: "SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[IQFDYA78S4qGwyJLJqm_dg][website][0]: SearchParseException[[website][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [
{"query":{"bool":{"must":[{"nested":{"path":"prefTitle","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefTitle.label":[["Nurse Practitioner"]]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"prefExperience","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefExperience.label":["0-1"]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"prefLiftWeight","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefLiftWeight.label":["25-50 lbs"]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"prefNonMedical","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefNonMedical.label":[["Bathing","Grooming","Toileting","Medication Reminders","Grocery & Shopping","Transferring & Mobility","Exercise","Transportation","Meal Prep","Housekeeping","Companionship","Dementia Care"]]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"prefActivity","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefActivity.label":[["Skilled Nursing","Wound Care","Administer Medication","Palliative Care","Speech Therapy","Physical Therapy","Respiratory Therapy","Occupation Therapy","Hospice","DME","IV Therapy","Other"]]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"prefLocation","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefLocation.label":["Clear Lake Area"]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"availability","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefDay":"M","morning":true}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"bool":{"must":[{"function_score":{"filter":{"term":{"isLicensed":true}},"functions":[{"script_score":{"script":"2"}}]}}]}},{"bool":{}},{"bool":{}}],"should":[{"bool":{"must":[{"function_score":{"filter":{"term":{"isInsured":[true,false]}},"functions":[{"script_score":{"script":"2"}}]}}]}}]}}}
]]]; nested: QueryParsingException[[website] script_score the script could not be loaded]; nested: ScriptException[scripts of type [inline], operation [search] and lang [groovy] are disabled]; }{[IQFDYA78S4qGwyJLJqm_dg][website][1]: SearchParseException[[website][1]: from[-1],size[-1]: Parse Failure [Failed to parse source [
{"query":{"bool":{"must":[{"nested":{"path":"prefTitle","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefTitle.label":[["Nurse Practitioner"]]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"prefExperience","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefExperience.label":["0-1"]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"prefLiftWeight","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefLiftWeight.label":["25-50 lbs"]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"prefNonMedical","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefNonMedical.label":[["Bathing","Grooming","Toileting","Medication Reminders","Grocery & Shopping","Transferring & Mobility","Exercise","Transportation","Meal Prep","Housekeeping","Companionship","Dementia Care"]]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"prefActivity","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefActivity.label":[["Skilled Nursing","Wound Care","Administer Medication","Palliative Care","Speech Therapy","Physical Therapy","Respiratory Therapy","Occupation Therapy","Hospice","DME","IV Therapy","Other"]]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"prefLocation","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefLocation.label":["Clear Lake Area"]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"availability","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefDay":"M","morning":true}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"bool":{"must":[{"function_score":{"filter":{"term":{"isLicensed":true}},"functions":[{"script_score":{"script":"2"}}]}}]}},{"bool":{}},{"bool":{}}],"should":[{"bool":{"must":[{"function_score":{"filter":{"term":{"isInsured":[true,false]}},"functions":[{"script_score":{"script":"2"}}]}}]}}]}}}
]]]; nested: QueryParsingException[[website] script_score the script could not be loaded]; nested: ScriptException[scripts of type [inline], operation [search] and lang [groovy] are disabled]; }{[IQFDYA78S4qGwyJLJqm_dg][website][2]: SearchParseException[[website][2]: from[-1],size[-1]: Parse Failure [Failed to parse source [
{"query":{"bool":{"must":[{"nested":{"path":"prefTitle","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefTitle.label":[["Nurse Practitioner"]]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"prefExperience","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefExperience.label":["0-1"]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"prefLiftWeight","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefLiftWeight.label":["25-50 lbs"]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"prefNonMedical","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefNonMedical.label":[["Bathing","Grooming","Toileting","Medication Reminders","Grocery & Shopping","Transferring & Mobility","Exercise","Transportation","Meal Prep","Housekeeping","Companionship","Dementia Care"]]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"prefActivity","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefActivity.label":[["Skilled Nursing","Wound Care","Administer Medication","Palliative Care","Speech Therapy","Physical Therapy","Respiratory Therapy","Occupation Therapy","Hospice","DME","IV Therapy","Other"]]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"prefLocation","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefLocation.label":["Clear Lake Area"]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"availability","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefDay":"M","morning":true}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"bool":{"must":[{"function_score":{"filter":{"term":{"isLicensed":true}},"functions":[{"script_score":{"script":"2"}}]}}]}},{"bool":{}},{"bool":{}}],"should":[{"bool":{"must":[{"function_score":{"filter":{"term":{"isInsured":[true,false]}},"functions":[{"script_score":{"script":"2"}}]}}]}}]}}}
]]]; nested: QueryParsingException[[website] script_score the script could not be loaded]; nested: ScriptException[scripts of type [inline], operation [search] and lang [groovy] are disabled]; }{[IQFDYA78S4qGwyJLJqm_dg][website][3]: SearchParseException[[website][3]: from[-1],size[-1]: Parse Failure [Failed to parse source [
{"query":{"bool":{"must":[{"nested":{"path":"prefTitle","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefTitle.label":[["Nurse Practitioner"]]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"prefExperience","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefExperience.label":["0-1"]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"prefLiftWeight","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefLiftWeight.label":["25-50 lbs"]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"prefNonMedical","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefNonMedical.label":[["Bathing","Grooming","Toileting","Medication Reminders","Grocery & Shopping","Transferring & Mobility","Exercise","Transportation","Meal Prep","Housekeeping","Companionship","Dementia Care"]]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"prefActivity","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefActivity.label":[["Skilled Nursing","Wound Care","Administer Medication","Palliative Care","Speech Therapy","Physical Therapy","Respiratory Therapy","Occupation Therapy","Hospice","DME","IV Therapy","Other"]]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"prefLocation","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefLocation.label":["Clear Lake Area"]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"availability","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefDay":"M","morning":true}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"bool":{"must":[{"function_score":{"filter":{"term":{"isLicensed":true}},"functions":[{"script_score":{"script":"2"}}]}}]}},{"bool":{}},{"bool":{}}],"should":[{"bool":{"must":[{"function_score":{"filter":{"term":{"isInsured":[true,false]}},"functions":[{"script_score":{"script":"2"}}]}}]}}]}}}
]]]; nested: QueryParsingException[[website] script_score the script could not be loaded]; nested: ScriptException[scripts of type [inline], operation [search] and lang [groovy] are disabled]; }{[IQFDYA78S4qGwyJLJqm_dg][website][4]: SearchParseException[[website][4]: from[-1],size[-1]: Parse Failure [Failed to parse source [
{"query":{"bool":{"must":[{"nested":{"path":"prefTitle","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefTitle.label":[["Nurse Practitioner"]]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"prefExperience","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefExperience.label":["0-1"]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"prefLiftWeight","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefLiftWeight.label":["25-50 lbs"]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"prefNonMedical","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefNonMedical.label":[["Bathing","Grooming","Toileting","Medication Reminders","Grocery & Shopping","Transferring & Mobility","Exercise","Transportation","Meal Prep","Housekeeping","Companionship","Dementia Care"]]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"prefActivity","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefActivity.label":[["Skilled Nursing","Wound Care","Administer Medication","Palliative Care","Speech Therapy","Physical Therapy","Respiratory Therapy","Occupation Therapy","Hospice","DME","IV Therapy","Other"]]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"prefLocation","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefLocation.label":["Clear Lake Area"]}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"nested":{"path":"availability","query":{"bool":{"must":[{"function_score":{"filter":{"term":{"prefDay":"M","morning":true}},"functions":[{"script_score":{"script":"2"}}]}}]}}}},{"bool":{"must":[{"function_score":{"filter":{"term":{"isLicensed":true}},"functions":[{"script_score":{"script":"2"}}]}}]}},{"bool":{}},{"bool":{}}],"should":[{"bool":{"must":[{"function_score":{"filter":{"term":{"isInsured":[true,false]}},"functions":[{"script_score":{"script":"2"}}]}}]}}]}}}
]]]; nested: QueryParsingException[[website] script_score the script could not be loaded]; nested: ScriptException[scripts of type [inline], operation [search] and lang [groovy] are disabled]; }]" at /home/eleazar/Desktop/Projects/ccweb1/vendor/ruflin/elastica/lib/Elastica/Transport/Http.php line 159
此代码之前已运行。我不知道是什么问题。请帮我。谢谢。
答案 0 :(得分:0)
在查询中,有两个空的bool块应删除:
{
"query": {
"bool": {
"must": [
{
"nested": {
"path": "prefTitle",
"query": {
"bool": {
"must": [
{
"function_score": {
"filter": {
"term": {
"prefTitle.label": [
[
"Nurse Practitioner"
]
]
}
},
"functions": [
{
"script_score": {
"script": "2"
}
}
]
}
}
]
}
}
}
},
{
"nested": {
"path": "prefExperience",
"query": {
"bool": {
"must": [
{
"function_score": {
"filter": {
"term": {
"prefExperience.label": [
"0-1"
]
}
},
"functions": [
{
"script_score": {
"script": "2"
}
}
]
}
}
]
}
}
}
},
{
"nested": {
"path": "prefLiftWeight",
"query": {
"bool": {
"must": [
{
"function_score": {
"filter": {
"term": {
"prefLiftWeight.label": [
"25-50 lbs"
]
}
},
"functions": [
{
"script_score": {
"script": "2"
}
}
]
}
}
]
}
}
}
},
{
"nested": {
"path": "prefNonMedical",
"query": {
"bool": {
"must": [
{
"function_score": {
"filter": {
"term": {
"prefNonMedical.label": [
[
"Bathing",
"Grooming",
"Toileting",
"Medication Reminders",
"Grocery & Shopping",
"Transferring & Mobility",
"Exercise",
"Transportation",
"Meal Prep",
"Housekeeping",
"Companionship",
"Dementia Care"
]
]
}
},
"functions": [
{
"script_score": {
"script": "2"
}
}
]
}
}
]
}
}
}
},
{
"nested": {
"path": "prefActivity",
"query": {
"bool": {
"must": [
{
"function_score": {
"filter": {
"term": {
"prefActivity.label": [
[
"Skilled Nursing",
"Wound Care",
"Administer Medication",
"Palliative Care",
"Speech Therapy",
"Physical Therapy",
"Respiratory Therapy",
"Occupation Therapy",
"Hospice",
"DME",
"IV Therapy",
"Other"
]
]
}
},
"functions": [
{
"script_score": {
"script": "2"
}
}
]
}
}
]
}
}
}
},
{
"nested": {
"path": "prefLocation",
"query": {
"bool": {
"must": [
{
"function_score": {
"filter": {
"term": {
"prefLocation.label": [
"Clear Lake Area"
]
}
},
"functions": [
{
"script_score": {
"script": "2"
}
}
]
}
}
]
}
}
}
},
{
"nested": {
"path": "availability",
"query": {
"bool": {
"must": [
{
"function_score": {
"filter": {
"term": {
"prefDay": "M",
"morning": true
}
},
"functions": [
{
"script_score": {
"script": "2"
}
}
]
}
}
]
}
}
}
},
{
"bool": {
"must": [
{
"function_score": {
"filter": {
"term": {
"isLicensed": true
}
},
"functions": [
{
"script_score": {
"script": "2"
}
}
]
}
}
]
}
},
{
"bool": {} <--------- remove this
},
{
"bool": {} <--------- remove this
}
],
"should": [
{
"bool": {
"must": [
{
"function_score": {
"filter": {
"term": {
"isInsured": [
true,
false
]
}
},
"functions": [
{
"script_score": {
"script": "2"
}
}
]
}
}
]
}
}
]
}
}
}