Note that there are some explanatory texts on larger screens.

plurals
  1. POElasticSearch issue with querying a multi-valued property
    primarykey
    data
    text
    <p>I'm running into an issue in that I have a document indexed with elasticsearch and when I query against a multi-valued field, it returns no results. Here is my search:</p> <blockquote> <p>curl -X GET "http://mncoboss13:9200/boss_model_reservations/_search?pretty=true" -d '{"query":{"match_all":{}},"filter":{"and":[{"terms":{"day_plan":["MO"]}}]},"size":100,"from":0}'</p> </blockquote> <p>Results in:</p> <blockquote> <p>{ "took" : 2, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 0, "max_score" : null, "hits" : [ ] } }</p> </blockquote> <p>Here is the way I've indexed the document (notice that day_plan is an array of strings). Notice that even in the example below, it has a day_plan with MO within it; however, given the above search, is not returned. Am I doing something wrong with my filter?</p> <blockquote> <p><strong>http://mncoboss13:9200/boss_model_reservations/_search?pretty=true&amp;q=*&amp;size=1</strong></p> </blockquote> <pre><code>{ "took" : 2, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 27493, "max_score" : 1.0, "hits" : [ { "_index" : "boss_model_reservations", "_type" : "boss_model_reservation", "_id" : "779588", "_score" : 1.0, "_source" : {"name":"","upccode":"701592001542","publish":true,"reservation_type":"class","time_start":37200.0,"time_end":39000.0,"date_start":"2012-07-19","date_end":"2012-07-30","day_plan":["MO","TU","WE","TH"]} } ] } } </code></pre> <p>UPDATE: The Type mapping for this index is here:</p> <pre><code>{ "boss_model_reservations" : { "boss_model_reservation" : { "properties" : { "date_end" : { "type" : "date", "format" : "dateOptionalTime" }, "date_start" : { "type" : "date", "format" : "dateOptionalTime" }, "day_plan" : { "type" : "string" }, "format_id" : { "type" : "long" }, "interest_id" : { "type" : "long" }, "name" : { "type" : "string" }, "option1" : { "type" : "string" }, "option2" : { "type" : "string" }, "option3" : { "type" : "string" }, "product_line_id" : { "type" : "long" }, "product_type" : { "type" : "string" }, "publish" : { "type" : "boolean" }, "reservation_type" : { "type" : "string" }, "resource" : { "type" : "string" }, "resource_type" : { "type" : "string" }, "time_end" : { "type" : "double" }, "time_start" : { "type" : "double" }, "upccode" : { "type" : "string" } } } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload