Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter query does not work. Elasticsearch 5.2 #15

Open
vetalpaprotsky opened this issue Feb 5, 2017 · 5 comments
Open

Filter query does not work. Elasticsearch 5.2 #15

vetalpaprotsky opened this issue Feb 5, 2017 · 5 comments

Comments

@vetalpaprotsky
Copy link

vetalpaprotsky commented Feb 5, 2017

screenshot from 2017-02-05 18 31 49

@multpix
Copy link

multpix commented Mar 9, 2017

Have ideas how to fix this?

@shtakai
Copy link

shtakai commented Mar 19, 2017

I posted on codemy's chat. Maybe it's same.
I made index.

RACK_ENV=production
RAILS_ENV=production
SECRET_KEY_BASE=aaaaaa
DB_HOST=postgres
DB_NAME=moviedb_production
DB_USER=postgres
DB_PASSWORD=aaaaaa
ELASTIC_HOST=elasticsearch
ELASTIC_PORT=9200
REDIS_HOST=redis
REDIS_PORT=6379
docker run -d --name elasticsearch -v es-config:/usr/share/elasticsearch/config -v es-data:/usr/share/elasticsearch/data elasticsearch
docker run -d -v pg-data:/var/lib/postgresql/data -p 5432:5432 --name postgres postgres
docker run -d --name redis redis
docker run -d --name moviedb_web_1 --env-file=.env.prod --link postgres:postgres --link elasticsearch:elasticsearch --link redis:redis -p 4000:4000 moviedb sh bin/web
docker run -d --name moviedb_worker_1 --env-file=.env.prod --link postgres:postgres --link elasticsearch:elasticsearch --link redis:redis moviedb sh bin/worker

I used Elasticsearch 5.x. Same error was occured on 2.4 and 5.x.

/usr/src/app # tail -f log/production.log 


I, [2017-03-19T11:00:59.688506 #7]  INFO -- : Started GET "/" for 172.17.0.1 at 2017-03-19 11:00:59 +0000
I, [2017-03-19T11:00:59.702962 #7]  INFO -- : Processing by LandingsController#show as HTML
I, [2017-03-19T11:00:59.721425 #7]  INFO -- :   Rendered landings/show.html.erb within layouts/landings (1.2ms)
I, [2017-03-19T11:00:59.725596 #7]  INFO -- :   Rendered layouts/shared/_footer.html.erb (0.9ms)
I, [2017-03-19T11:00:59.725906 #7]  INFO -- : Completed 200 OK in 23ms (Views: 10.3ms | ActiveRecord: 0.0ms | Elasticsearch: 0.0ms)
I, [2017-03-19T11:01:06.246443 #7]  INFO -- : Started GET "/movies?utf8=%E2%9C%93&q=test" for 172.17.0.1 at 2017-03-19 11:01:06 +0000
I, [2017-03-19T11:01:06.248910 #7]  INFO -- : Processing by MoviesController#index as HTML
I, [2017-03-19T11:01:06.249001 #7]  INFO -- :   Parameters: {"utf8"=>"✓", "q"=>"test"}
I, [2017-03-19T11:01:06.250522 #7]  INFO -- : Redirected to http://localhost:4000/movies/search/keyword/test
I, [2017-03-19T11:01:06.250696 #7]  INFO -- : Filter chain halted as :beautify_search_url rendered or redirected
I, [2017-03-19T11:01:06.250813 #7]  INFO -- : Completed 302 Found in 2ms (ActiveRecord: 0.0ms | Elasticsearch: 0.0ms)
I, [2017-03-19T11:01:06.294539 #7]  INFO -- : Started GET "/movies/search/keyword/test" for 172.17.0.1 at 2017-03-19 11:01:06 +0000
I, [2017-03-19T11:01:06.297494 #7]  INFO -- : Processing by MoviesController#index as HTML
I, [2017-03-19T11:01:06.297664 #7]  INFO -- :   Parameters: {"query"=>"keyword/test"}
D, [2017-03-19T11:01:06.339718 #7] DEBUG -- :   Movie Search (40.3ms) {index: "movies", type: "movie", body: {query: {multi_match: {query: "test", type: "best_fields", fields: ["name^9", "synopsis^8", "year", "language^7", "country", "genres.name", "crews.name^10"], operator: "and"}}, aggs: {crew_aggregation: {nested: {path: "crews"}, aggs: {id_and_name: {terms: {script: "doc['crews.id'].value + '|' + doc['crews.name'].value", size: 15}}}}, genre_aggregation: {nested: {path: "genres"}, aggs: {id_and_name: {terms: {script: "doc['genres.id'].value + '|' + doc['genres.name'].value", size: 15}}}}}, filter: {bool: {must: []}}}}
I, [2017-03-19T11:01:06.339945 #7]  INFO -- : Completed 500 Internal Server Error in 42ms (ActiveRecord: 0.0ms | Elasticsearch: 40.3ms)
F, [2017-03-19T11:01:06.340872 #7] FATAL -- : 
Elasticsearch::Transport::Transport::Errors::BadRequest ([400] {"error":{"root_cause":[{"type":"parsing_exception","reason":"Unknown key for a START_OBJECT in [filter].","line":1,"col":510}],"type":"parsing_exception","reason":"Unknown key for a START_OBJECT in [filter].","line":1,"col":510},"status":400}):
  app/controllers/movies_controller.rb:8:in `index'

Here is Elasticsearch's log.

[2017-03-19T10:58:47,091][INFO ][o.e.n.Node               ] [] initializing ...
[2017-03-19T10:58:47,212][INFO ][o.e.e.NodeEnvironment    ] [jzr9nsn] using [1] data paths, mounts [[/usr/share/elasticsearch/data (/dev/mapper/ubuntu--gnome--vg-root)]], net usable_space [390.8gb], net total_space [452.6gb], spins? [possibly], types [ext4]
[2017-03-19T10:58:47,213][INFO ][o.e.e.NodeEnvironment    ] [jzr9nsn] heap size [1.9gb], compressed ordinary object pointers [true]
[2017-03-19T10:58:47,238][INFO ][o.e.n.Node               ] node name [jzr9nsn] derived from node ID [jzr9nsnMTOiZcENqBJInNg]; set [node.name] to override
[2017-03-19T10:58:47,241][INFO ][o.e.n.Node               ] version[5.2.2], pid[1], build[f9d9b74/2017-02-24T17:26:45.835Z], OS[Linux/4.8.0-41-generic/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_121/25.121-b13]
[2017-03-19T10:58:48,291][INFO ][o.e.p.PluginsService     ] [jzr9nsn] loaded module [aggs-matrix-stats]
[2017-03-19T10:58:48,291][INFO ][o.e.p.PluginsService     ] [jzr9nsn] loaded module [ingest-common]
[2017-03-19T10:58:48,291][INFO ][o.e.p.PluginsService     ] [jzr9nsn] loaded module [lang-expression]
[2017-03-19T10:58:48,292][INFO ][o.e.p.PluginsService     ] [jzr9nsn] loaded module [lang-groovy]
[2017-03-19T10:58:48,292][INFO ][o.e.p.PluginsService     ] [jzr9nsn] loaded module [lang-mustache]
[2017-03-19T10:58:48,292][INFO ][o.e.p.PluginsService     ] [jzr9nsn] loaded module [lang-painless]
[2017-03-19T10:58:48,292][INFO ][o.e.p.PluginsService     ] [jzr9nsn] loaded module [percolator]
[2017-03-19T10:58:48,292][INFO ][o.e.p.PluginsService     ] [jzr9nsn] loaded module [reindex]
[2017-03-19T10:58:48,292][INFO ][o.e.p.PluginsService     ] [jzr9nsn] loaded module [transport-netty3]
[2017-03-19T10:58:48,292][INFO ][o.e.p.PluginsService     ] [jzr9nsn] loaded module [transport-netty4]
[2017-03-19T10:58:48,295][INFO ][o.e.p.PluginsService     ] [jzr9nsn] no plugins loaded
[2017-03-19T10:58:48,500][WARN ][o.e.d.s.g.GroovyScriptEngineService] [groovy] scripts are deprecated, use [painless] scripts instead
[2017-03-19T10:58:51,357][INFO ][o.e.n.Node               ] initialized
[2017-03-19T10:58:51,357][INFO ][o.e.n.Node               ] [jzr9nsn] starting ...
[2017-03-19T10:58:51,475][WARN ][i.n.u.i.MacAddressUtil   ] Failed to find a usable hardware address from the network interfaces; using random bytes: 42:c2:6f:9a:81:bc:00:58
[2017-03-19T10:58:51,653][INFO ][o.e.t.TransportService   ] [jzr9nsn] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
[2017-03-19T10:58:51,697][WARN ][o.e.b.BootstrapChecks    ] [jzr9nsn] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2017-03-19T10:58:54,795][INFO ][o.e.c.s.ClusterService   ] [jzr9nsn] new_master {jzr9nsn}{jzr9nsnMTOiZcENqBJInNg}{C5LmOO15RCidyJRPWK6iZw}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)
[2017-03-19T10:58:54,826][INFO ][o.e.h.HttpServer         ] [jzr9nsn] publish_address {172.17.0.2:9200}, bound_addresses {[::]:9200}
[2017-03-19T10:58:54,826][INFO ][o.e.n.Node               ] [jzr9nsn] started
[2017-03-19T10:58:55,137][INFO ][o.e.g.GatewayService     ] [jzr9nsn] recovered [1] indices into cluster_state
[2017-03-19T10:58:55,576][INFO ][o.e.c.r.a.AllocationService] [jzr9nsn] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[movies][1]] ...]).
[2017-03-19T11:00:27,104][INFO ][o.e.c.m.MetaDataDeleteIndexService] [jzr9nsn] [movies/1sY6Duk5Qi-U5L44Y8OpIQ] deleting index
[2017-03-19T11:00:27,250][WARN ][o.e.d.i.m.StringFieldMapper$TypeParser] The [string] field is deprecated, please use [text] or [keyword] instead on [country]
[2017-03-19T11:00:27,250][WARN ][o.e.d.i.m.StringFieldMapper$TypeParser] The [string] field is deprecated, please use [text] or [keyword] instead on [year]
[2017-03-19T11:00:27,250][WARN ][o.e.d.i.m.StringFieldMapper$TypeParser] The [string] field is deprecated, please use [text] or [keyword] instead on [name]
[2017-03-19T11:00:27,250][WARN ][o.e.d.i.m.StringFieldMapper$TypeParser] The [string] field is deprecated, please use [text] or [keyword] instead on [name]
[2017-03-19T11:00:27,251][WARN ][o.e.d.i.m.StringFieldMapper$TypeParser] The [string] field is deprecated, please use [text] or [keyword] instead on [language]
[2017-03-19T11:00:27,251][WARN ][o.e.d.i.m.StringFieldMapper$TypeParser] The [string] field is deprecated, please use [text] or [keyword] instead on [name]
[2017-03-19T11:00:27,251][WARN ][o.e.d.i.m.StringFieldMapper$TypeParser] The [string] field is deprecated, please use [text] or [keyword] instead on [id]
[2017-03-19T11:00:27,251][WARN ][o.e.d.i.m.StringFieldMapper$TypeParser] The [string] field is deprecated, please use [text] or [keyword] instead on [synopsis]
[2017-03-19T11:00:27,270][INFO ][o.e.c.m.MetaDataCreateIndexService] [jzr9nsn] [movies] creating index, cause [api], templates [], shards [5]/[1], mappings [movie]

@zacksiri
Copy link
Member

I will take a look at this issue this week, to upgrade the code to support the latest version of elastic. My apologies for the delay.

@multpix
Copy link

multpix commented Mar 20, 2017

thanks , you make great work)

@shtakai
Copy link

shtakai commented Mar 22, 2017

👍 Thanks :) 🍣

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants