ElasticSearch has_parent query -


i experimenting elasticsearch parent/child simple examples fun-with-elasticsearch-s-children-and-nested-documents/. able query child elements running query in blog

curl -xpost localhost:9200/authors/bare_author/_search -d '{ 

however, not tweak example has_parent query. can please point doing wrong, keep getting 0 results.

this tried

#returns 0 hits     curl -xpost localhost:9200/authors/book/_search -d '{   "query": {     "has_parent": {       "type": "bare_author",       "query" : {         "filtered": {           "query": { "match_all": {}},           "filter" : {"term": {  "name": "alastair reynolds"}}                       }         }       }     }   }'   #did not work either curl -xpost localhost:9200/authors/book/_search -d '{ "query": {     "has_parent" : {         "type" : "bare_author",        "query" : {         "term" : {                 "name" : "alastair reynolds"             }         }     } } }'  

this works match matching first name

    #works matches first name curl -xpost localhost:9200/authors/book/_search -d '{ "query": {     "has_parent" : {         "type" : "bare_author",        "query" : {         "match" : {"name": "alastair"}         }     }   } }'  

i suppose using default mappings, analysing name field using standard analyzer. on other hand, term query , term filter don't support text analysis search token alastair reynolds while in index have alastair , reynolds 2 different tokens , lowercased.

the match query returns result because it's analyzed, underneath lowercased , finds matches. can change term query , make match query, find matches multiple terms, because in case tokenized on whitespaces , generate boolean or dismax query out of different terms provided.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -