2012-04-03 2 views
1

elasticsearch로 인덱스 된 문서가 있고 여러 값 필드에 대해 쿼리 할 때 결과가 반환되지 않는 문제가 있습니다. 여기 내 검색입니다 :다중 값 속성을 쿼리하는 중 ElasticSearch 문제

컬 -X GET에 "http : // mncoboss13 : 9200/boss_model_reservations/_search 꽤 = true"로 -d '{ "쿼리를": { "match_all을": {}} , "필터": { "및": {{ "용어": { "day_plan": [ "MO"]}}} "크기": 100, "에서": 0} '

가 { "했다": 결과 2, "TIMED_OUT"거짓 "_shards": { "총": 5, "성공": 5, "FAI 주도 ": 0},"히트 ": { "총 ": 0, "MAX_SCORE "널 (null), "히트 ": []}} 여기

내가 문서를 색인 한 방법입니다 day_plan은 문자열 배열입니다. 아래 예에서도 MO가있는 day_plan이 있습니다. 그러나 위의 검색을 감안할 때 반환되지 않습니다. 필터에 문제가 있습니까?

에 http : // mncoboss13 : 9200/boss_model_reservations/_search 꽤 = 사실 & Q = * & 크기 = 1

{ 
     "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"]} 
      } ] 
     } 
     } 

는 UPDATE :이 인덱스의 유형 매핑은 여기 :

{ 
    "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" 
     } 
     } 
    } 
    } 
} 

답변

3

"boss_model_reservation"에 대한 매핑 유형은 무엇입니까? 필터라는 용어는 "day_plan"필드가 분석되지 않은 것으로 가정합니다.

+0

인덱스 매핑을 보여주기 위해 질문을 업데이트했습니다. "문자열" – ejlevin1

+0

-XPUT 컬 'HTTP : // localhost를 : 9200/boss_model_reservations/boss_model_reservation/_mapping'-d '{ "boss_model_reservation": { "속성": { "day_plan"그것은 형식으로 진술한다 : { "유형": "문자열", "인덱스": "not_analyzed"} : { "유형": "문자열", "인덱스" } } 은} ' – ejain

+0

매핑은 "day_plan"을 보여줄 필요가있다 : "not_analyzed" }이면 필터라는 용어가 작동합니다. – ejain

관련 문제