Hey I recently ran in to an issues that seemed to work in the 0.90.x series 
that doesn't seem to work the same way in the current version of 
Elasticsearch 1.1.1.  The issue is prefacing the fields with the type.

Create some data:

curl -XPUT localhost:9200/junk/junk/1 -d 
'{"person":{"name":{"_id":"1","first":"Joe"},"address":{"_id":"abcd","line1":"444
 
Joe Empire","line2":"Suite 100"}}}'

curl -XPUT localhost:9200/junk/junk/2 -d 
'{"person":{"name":{"_id":"1","first":"Jack"},"address":{"_id":"abcd","line1":"444
 
Joe Empire","line2":"Suite 100"}}}'


$ curl -XGET 'localhost:9200/junk/junk/_search?pretty' -d '{ "query": { 
"query_string": { "use_dis_max": true, "query": "joe", "fields": 
["person.name.*^1.2", "person.address.*^1.1"] } } }'
{
  "took" : 1,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : 2,
    "max_score" : 0.09415865,
    "hits" : [ {
      "_index" : "junk",
      "_type" : "junk",
      "_id" : "1",
      "_score" : 0.09415865, "_source" : 
{"person":{"name":{"_id":"1","first":"Joe"},"address":{"_id":"abcd","line1":"444
 
Joe Empire","line2":"Suite 100"}}}
    }, {
      "_index" : "junk",
      "_type" : "junk",
      "_id" : "2",
      "_score" : 0.043156046, "_source" : 
{"person":{"name":{"_id":"1","first":"Jack"},"address":{"_id":"abcd","line1":"444
 
Joe Empire","line2":"Suite 100"}}}
    } ]
  }
}

# Why does this not work?

$ curl -XGET 'localhost:9200/junk/junk/_search?pretty' -d '{ "query": { 
"query_string": { "use_dis_max": true, "query": "joe", "fields": 
["junk.person.name.*^1.2", "junk.person.address.*^1.1"] } } }'
{
  "took" : 1,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : 0,
    "max_score" : null,
    "hits" : [ ]
  }
}

# I have to use the fully qualified field to get hits now...

$ curl -XGET 'localhost:9200/junk/junk/_search?pretty' -d '{ "query": { 
"query_string": { "use_dis_max": true, "query": "joe", "fields": 
["junk.person.name.first^1.2", "junk.person.address.*^1.1"] } } }'
{
  "took" : 1,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : 1,
    "max_score" : 0.30685282,
    "hits" : [ {
      "_index" : "junk",
      "_type" : "junk",
      "_id" : "1",
      "_score" : 0.30685282, "_source" : 
{"person":{"name":{"_id":"1","first":"Joe"},"address":{"_id":"abcd","line1":"444
 
Joe Empire","line2":"Suite 100"}}}
    } ]
  }
}

$ curl -XGET 'localhost:9200/junk/junk/_search?pretty' -d '{ "query": { 
"query_string": { "use_dis_max": true, "query": "joe", "fields": 
["junk.person.name.first^1.2", "junk.person.address.line1^1.1"] } } }'
{
  "took" : 1,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : 2,
    "max_score" : 0.30685285,
    "hits" : [ {
      "_index" : "junk",
      "_type" : "junk",
      "_id" : "1",
      "_score" : 0.30685285, "_source" : 
{"person":{"name":{"_id":"1","first":"Joe"},"address":{"_id":"abcd","line1":"444
 
Joe Empire","line2":"Suite 100"}}}
    }, {
      "_index" : "junk",
      "_type" : "junk",
      "_id" : "2",
      "_score" : 0.04315605, "_source" : 
{"person":{"name":{"_id":"1","first":"Jack"},"address":{"_id":"abcd","line1":"444
 
Joe Empire","line2":"Suite 100"}}}
    } ]
  }
}


-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/39498c84-5727-4719-9a69-909b19b8eac2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to