Re: Grandchild is not getting fetched by parent id
Got my mistake, thank you! And sorry for missing the man page. пятница, 16 января 2015 г., 7:05:17 UTC+3 пользователь Masaru Hasegawa написал: Hi Iv, You’d need to specify both parent and routing when you index grand children. See http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/grandparents.html Masaru On January 15, 2015 at 20:44:43, Iv Igi (sayo...@gmail.com javascript:) wrote: I am experiencing an issue while trying to retrieve a grandchild record by its parent ID. (child-grandchild relationship) The amount of hits in result is always zero. Also the same request is working fine for parent-child relationship. My records are getting organized kinda like this: Account --(one to one)-- User --(one to one)-- Address My execution environment is: - Fedora 21 CE - openjdk 1.8.0_25 - ES 1.4.2 Here is a script that is showing the problem # index creation curl -XPUT localhost:9200/the_index/ -d { \mappings\: { \account\ : {}, \user\ : { \_parent\ : { \type\ : \account\ } }, \address\ : { \_parent\ : { \type\ : \user\ } } } }; # mrsmith account creation curl -XPUT localhost:9200/the_index/account/mrsmith -d { \foo\ : \foo\ }; # john user creation curl -XPUT localhost:9200/the_index/user/john?parent=mrsmith -d { \bar\ : \bar\ }; # john user creation curl -XPUT localhost:9200/the_index/address/smithshouse?parent=john -d { \baz\ : \baz\ }; # Here I am trying to retrieve a record. Getting zero hits. curl -XGET localhost:9200/the_index/address/_search?pretty -d { \query\ : { \bool\ : { \must\ : { \term\ : { \_parent\ : \john\ } } } } }; # Another approach with has_parent query type. Still getting zero hits. curl -XGET localhost:9200/the_index/address/_search?pretty -d { \query\ : { \has_parent\ : { \parent_type\ : \user\, \query\ : { \term\ : { \_id\ : \john\ } } } } }; # OK, lets try a routed search. Nope curl -XGET localhost:9200/the_index/address/_search?routing=johnpretty -d { \query\ : { \bool\ : { \must\ : { \term\ : { \_parent\ : \john\ } } } } }; # Routed has_parent query. Same curl -XGET localhost:9200/the_index/address/_search?routing=johnpretty -d { \query\ : { \has_parent\ : { \parent_type\ : \user\, \query\ : { \term\ : { \_id\ : \john\ } } } } }; # Retrieving a record by itself. Going just fine. curl -XGET localhost:9200/the_index/address/smithshouse?parent=john; # Querying for user record with the same query. Got a hit. curl -XGET localhost:9200/the_index/user/_search?pretty -d { \query\ : { \bool\ : { \must\ : { \term\ : { \_parent\ : \mrsmith\ } } } } }; The output: {acknowledged:true} {_index:the_index,_type:account,_id:mrsmith,_version:1,created:true}{_index:the_index,_type:user,_id:john,_version:1,created:true}{_index:the_index,_type:address,_id:smithshouse,_version:1,created:true} { took : 54, timed_out : false, _shards : { total : 5, successful : 5, failed : 0 }, hits : { total : 0, max_score : null, hits : [ ] } } { took : 221, timed_out : false, _shards : { total : 5, successful : 5, failed : 0 }, hits : { total : 0, max_score : null, hits : [ ] } } { took : 35, timed_out : false, _shards : { total : 1, successful : 1, failed : 0 }, hits : { total : 0, max_score : null, hits : [ ] } } { took : 481, timed_out : false, _shards : { total : 1, successful : 1, failed : 0 }, hits : { total : 0, max_score : null, hits : [ ] } } {_index:the_index,_type:address,_id:smithshouse,_version:1,found:true,_source:{ baz : baz }} { took : 65, timed_out : false, _shards : { total : 5, successful : 5, failed : 0 }, hits : { total : 1, max_score : 1.0, hits : [ { _index : the_index, _type : user, _id : john, _score : 1.0, _source:{ bar : bar } } ] } } You can find out on resuls that ES got the required shard, but no records have been fetched. Probably I am doing it in a wrong way, and if it so please fix me up. -- You received this message because you are subscribed to the Google Groups elasticsearch group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearc...@googlegroups.com javascript:. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/bbaebc65-a87f-4857-a2a4-577b0b487c6b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed
Grandchild is not getting fetched by parent id
I am experiencing an issue while trying to retrieve a grandchild record by its parent ID. (child-grandchild relationship) The amount of hits in result is always zero. Also the same request is working fine for parent-child relationship. My records are getting organized kinda like this: Account --(one to one)-- User --(one to one)-- Address My execution environment is: - Fedora 21 CE - openjdk 1.8.0_25 - ES 1.4.2 Here is a script that is showing the problem # index creation curl -XPUT localhost:9200/the_index/ -d { \mappings\: { \account\ : {}, \user\ : { \_parent\ : { \type\ : \account\ } }, \address\ : { \_parent\ : { \type\ : \user\ } } } }; # mrsmith account creation curl -XPUT localhost:9200/the_index/account/mrsmith -d { \foo\ : \foo\ }; # john user creation curl -XPUT localhost:9200/the_index/user/john?parent=mrsmith -d { \bar\ : \bar\ }; # john user creation curl -XPUT localhost:9200/the_index/address/smithshouse?parent=john -d { \baz\ : \baz\ }; # Here I am trying to retrieve a record. Getting zero hits. curl -XGET localhost:9200/the_index/address/_search?pretty -d { \query\ : { \bool\ : { \must\ : { \term\ : { \_parent\ : \john\ } } } } }; # Another approach with has_parent query type. Still getting zero hits. curl -XGET localhost:9200/the_index/address/_search?pretty -d { \query\ : { \has_parent\ : { \parent_type\ : \user\, \query\ : { \term\ : { \_id\ : \john\ } } } } }; # OK, lets try a routed search. Nope curl -XGET localhost:9200/the_index/address/_search?routing=johnpretty -d { \query\ : { \bool\ : { \must\ : { \term\ : { \_parent\ : \john\ } } } } }; # Routed has_parent query. Same curl -XGET localhost:9200/the_index/address/_search?routing=johnpretty -d { \query\ : { \has_parent\ : { \parent_type\ : \user\, \query\ : { \term\ : { \_id\ : \john\ } } } } }; # Retrieving a record by itself. Going just fine. curl -XGET localhost:9200/the_index/address/smithshouse?parent=john; # Querying for user record with the same query. Got a hit. curl -XGET localhost:9200/the_index/user/_search?pretty -d { \query\ : { \bool\ : { \must\ : { \term\ : { \_parent\ : \mrsmith\ } } } } }; The output: {acknowledged:true} {_index:the_index,_type:account,_id:mrsmith,_version:1,created:true}{_index:the_index,_type:user,_id:john,_version:1,created:true}{_index:the_index,_type:address,_id:smithshouse,_version:1,created:true} { took : 54, timed_out : false, _shards : { total : 5, successful : 5, failed : 0 }, hits : { total : 0, max_score : null, hits : [ ] } } { took : 221, timed_out : false, _shards : { total : 5, successful : 5, failed : 0 }, hits : { total : 0, max_score : null, hits : [ ] } } { took : 35, timed_out : false, _shards : { total : 1, successful : 1, failed : 0 }, hits : { total : 0, max_score : null, hits : [ ] } } { took : 481, timed_out : false, _shards : { total : 1, successful : 1, failed : 0 }, hits : { total : 0, max_score : null, hits : [ ] } } {_index:the_index,_type:address,_id:smithshouse,_version:1,found:true,_source:{ baz : baz }} { took : 65, timed_out : false, _shards : { total : 5, successful : 5, failed : 0 }, hits : { total : 1, max_score : 1.0, hits : [ { _index : the_index, _type : user, _id : john, _score : 1.0, _source:{ bar : bar } } ] } } You can find out on resuls that ES got the required shard, but no records have been fetched. Probably I am doing it in a wrong way, and if it so please fix me up. -- You received this message because you are subscribed to the Google Groups elasticsearch group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/bbaebc65-a87f-4857-a2a4-577b0b487c6b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Attachment field questions and some more
Hello there! I have some questions about Attachment field, results highlighting and suggesting. 1. Is the Attachment field storing whole file or extracted text only by default? 2. If it stores the whole file is there any way to make it store only extracted text? Or should I extract it with Apache Tika first and then put it to ES storage for that purpose? 3. Is it possible to set min and max for number of words that will be displayed in highlight field? 4. And almost the same for suggestions. Can I set up phrase suggestioning? I.e. returning Green grass, Green logo, etc. for Green suggestion query. Regards, Iv Igi. -- You received this message because you are subscribed to the Google Groups elasticsearch group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/8ef29407-5c30-4d3b-bf3e-b968c82dd9eb%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.