I try to execute example from:
https://github.com/FriendsOfSymfony/FOSElasticaBundle/blob/2.1.x/README.md
$fieldQuery = new \Elastica_Query_Text();
$fieldQuery->setFieldQuery('title', 'I am a title string');
$fieldQuery->setFieldParam('title', 'analyzer', 'my_analyzer');
$boolQuery->addShould($fieldQuery);
Configuration:
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
indexes:
site:
settings:
index:
analysis:
analyzer:
my_analyzer:
type: snowball
language: English
types:
article:
mappings:
title: { boost: 10, analyzer: my_analyzer }
tags:
categoryIds:
persistence:
driver: orm
model: Acme\DemoBundle\Entity\Article
provider:
finder:
I have same configuration and db tables, but I get error:
SearchPhaseExecutionException[Failed to execute phase [query], all shards failed;
shardFailures {[qtEeqhjbTyWPoPlp9mhwGQ][site][0]: SearchParseException[[site][0]: from[-1],size[-1]:
Parse Failure [Failed to parse source [
{
"query": {
"bool": {
"should": [
{
"text": {
"artText": {
"query": "I am a title string"
}
}
}
]
}
}
}
]]];
nested: QueryParsingException[[site] No query registered for [text]]; }{[qtEeqhjbTyWPoPlp9mhwGQ][site][1]:
SearchParseException[[site][1]: from[-1],size[-1]:
Parse Failure [Failed to parse source [
{
"query": {
"bool": {
"should": [
{
"text": {
"artText": {
"query": "I am a title string"
}
}
}
]
}
}
}
]]];
nested: QueryParsingException[[site] No query registered for [text]]; }{[qtEeqhjbTyWPoPlp9mhwGQ][site][2]:
SearchParseException[[site][2]: from[-1],size[-1]:
Parse Failure [Failed to parse source [
{
"query": {
"bool": {
"should": [
{
"text": {
"artText": {
"query": "I am a title string"
}
}
}
]
}
}
}
]]];
nested: QueryParsingException[[site] No query registered for [text]]; }{[qtEeqhjbTyWPoPlp9mhwGQ][site][3]:
SearchParseException[[site][3]: from[-1],size[-1]:
Parse Failure [Failed to parse source [
{
"query": {
"bool": {
"should": [
{
"text": {
"artText": {
"query": "I am a title string"
}
}
}
]
}
}
}
]]];
nested: QueryParsingException[[site] No query registered for [text]]; }{[qtEeqhjbTyWPoPlp9mhwGQ][site][4]:
SearchParseException[[site][4]: from[-1],size[-1]:
Parse Failure [Failed to parse source [
{
"query": {
"bool": {
"should": [
{
"text": {
"artText": {
"query": "I am a title string"
}
}
}
]
}
}
}
]]];
nested: QueryParsingException[[site] No query registered for [text]]; }]
What can couse this problem ? maybe elasticsearch server version ?
Have you tried to flush your cache and (re)populate your index?
php app/console cache:clear
php app/console f:e:p
Then just reload your query.
There's also a typo in the yml (before analysis).
First of all check elasticsearch is running or not:
$ Curl localhost:9200
It will return the version of elasticsearch. After that check if your indexes appeared in elasticsearch or not:
$ curl http://localhost:9200/_aliases?pretty=1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.