More Like This issues and default settings


(redrubia) #1

I have added two documents, all being the same but with different id's. The
main aim of this being to test out a More Like This query

Now the document is as follows:

curl -XPUT 'http://localhost:9200/blog/post/1' -d '
{
"user": "dilbert",
"postDate": "2011-12-15",
"body": "Search is hard. Search should be easy." ,
"title": "On search"
}'

This is then added again changing the doc id to 2. I query this as follows:

curl -XGET 'http://localhost:9200/blog/post/2/_mlt?mlt_fields=body&min_doc_freq=1'

{"took":2,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":0.16273327,"hits":[{"_index":"blog","_type":"post","_id":"1","_score":0.16273327, "_source" :
{
"user": "dilbert",
"postDate": "2011-12-15",
"body": "Search is hard. Search should be easy." ,
"title": "On search"
}}]}}%

But now I want to query on another aspect, like title, I get no results:

curl -XGET 'http://localhost:9200/blog/post/2/_mlt?mlt_fields=title&min_doc_freq=1'

{"took":1,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}%

Does this mean body defaults to being the only thing you can use More Like
This on?

I assumed it was due to no mapping being set by myself, and tried the
queries again just querying the title, before body - assuming my query had
an impact on setting the 'like this' property. But again querying with body
returned results, title and user did not return any results, although
identical.

I think thought maybe it was due to 'body', alphabetically being before
'user' and 'title' and thus the default maybe looks at the property higher
in the alphabet. So I deleted the index,curl -XDELETE localhost:9200/blog and
retried, with a new document input

curl -XPUT 'http://localhost:9200/blog/post/1' -d '
{
"abc": "lala land",
"user": "dilbert",
"postDate": "2011-12-15",
"body": "Search is hard. Search should be easy." ,
"title": "On search"
}'

But once again the MLT only seems to work on body. Seems odd!

Any ideas as to where I am going wrong? I even restarted my ES to try and
get it working.

EDIT: I've now tried setting my own mapping before adding docs:

curl -XPOST 'http://localhost:9200/blog/post/_mapping' -d '{
"post" : {
"properties" : {
"body" : {
"type" : "string",
"store" : true
},
"postDate" : {
"type" : "date",
"format" : "dateOptionalTime",
"store" : true
},
"title" : {
"type" : "string",
"store" : true
},
"user" : {
"type" : "string",
"store" : true
}
}
}
}'

This adds that every property is stored,as specified as a requirement in MLThttp://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-more-like-this.html#search-more-like-this but
alas, still nothing is returned when querying other properties.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/f16c1fa5-bfa7-4c73-ae12-20cce0b6e578%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2