No result in field

Hi guys,

i have a problem. I search word, its ok, but a have filter categories s via cat (integer), there is a problem. If i find without cat, I find result, but if i had select category i cant get any result.

If i test simple query, i don't get any result for category.

Query

body: {
	query: {
		filtered: {
			filter: {
				term: {
					cat: 27
					}
				}
			}
		}
	}

Mappings

'mappings' => [
	'product' => [
		'_all' => [
			'index_analyzer' => 'edge_ngram_filter',
			'search_analyzer' => 'standard'
		],
		'properties' => [
			'title' => [
				'type' => 'string',
				'index' => 'not_analyzed',
			],
			'description' => [
				'type' => 'string',
				'index' => 'not_analyzed',
			],
			'cat' => [
				'type' => 'integer',
				'index' => 'not_analyzed',
				'include_in_all' => FALSE
			],
			'price' => [
				'type' => 'float',
				'index' => 'no',
				'include_in_all' => FALSE
			],
			'image' => [
				'type' => 'string',
				'index' => 'no',
				'include_in_all' => FALSE
			],
			'url' => [
				'type' => 'string',
				'index' => 'no',
				'include_in_all' => FALSE					
			],
		]
	],

Data http://127.0.0.1:9200/product/_search?q=.

{
  "took": 7,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
  },
  "hits": {
    "total": 4034,
    "max_score": 1,
    "hits": [
      {
        "_index": "product",
        "_type": "73",
        "_id": "73",
        "_score": 1,
        "_source": {
          "id": 73,
          "title": "Chappi Hovězí a drůbeží kompletní krmivo pro dospělé psy 100g",
          "description": "čočka je fakt velká sračka",
          "price": 9.048,
          "image": "/content/product/73.jpg",
          "cat": 27,
          "url": "/produkt/73?url=Chappi+Hov%C4%9Bz%C3%AD+a+dr%C5%AFbe%C5%BE%C3%AD+kompletn%C3%AD+krmivo+pro+dosp%C4%9Bl%C3%A9+psy+100g"
        }
      },
      {
        "_index": "product",
        "_type": "78",
        "_id": "78",
        "_score": 1,
        "_source": {
          "id": 78,
          "title": "Pedigree Hovězí maso v želé kompletní krmivo pro dospělé psy 100g",
          "description": "čočka je fakt velká sračka",
          "price": 11.401,
          "image": "/content/product/78.jpg",
          "cat": 27,
          "url": "/produkt/78?url=Pedigree+Hov%C4%9Bz%C3%AD+maso+v+%C5%BEel%C3%A9+kompletn%C3%AD+krmivo+pro+dosp%C4%9Bl%C3%A9+psy+100g"
        }
      },
      {
        "_index": "product",
        "_type": "80",
        "_id": "80",
        "_score": 1,
        "_source": {
          "id": 80,
          "title": "Pedigree Junior Kuřecí maso v želé kompletní krmivo pro rostoucí psy a štěňata 100g",
          "description": "čočka je fakt velká sračka",
          "price": 11.401,
          "image": "/content/product/80.jpg",
          "cat": 27,
          "url": "/produkt/80?url=Pedigree+Junior+Ku%C5%99ec%C3%AD+maso+v+%C5%BEel%C3%A9+kompletn%C3%AD+krmivo+pro+rostouc%C3%AD+psy+a+%C5%A1t%C4%9B%C5%88ata+100g"
        }
      },
      {
        "_index": "product",
        "_type": "85",
        "_id": "85",
        "_score": 1,
        "_source": {
          "id": 85,
          "title": "Propesko Kompletní krmivo pro dospělé psy všech plemen výběr mas 4 x 100g",
          "description": "čočka je fakt velká sračka",
          "price": 33.67,
          "image": "/content/product/85.jpg",
          "cat": 27,
          "url": "/produkt/85?url=Propesko+Kompletn%C3%AD+krmivo+pro+dosp%C4%9Bl%C3%A9+psy+v%C5%A1ech+plemen+v%C3%BDb%C4%9Br+mas+4+x+100g"
        }
      },
      {
        "_index": "product",
        "_type": "92",
        "_id": "92",
        "_score": 1,
        "_source": {
          "id": 92,
          "title": "Pedigree Rodeo Lahodné závitky na žvýkání s kuřecím masem 70g",
          "description": "čočka je fakt velká sračka",
          "price": 16.588,
          "image": "/content/product/92.jpg",
          "cat": 27,
          "url": "/produkt/92?url=Pedigree+Rodeo+Lahodn%C3%A9+z%C3%A1vitky+na+%C5%BEv%C3%BDk%C3%A1n%C3%AD+s+ku%C5%99ec%C3%ADm+masem+70g"
        }
      },
      {
        "_index": "product",
        "_type": "97",
        "_id": "97",
        "_score": 1,
        "_source": {
          "id": 97,
          "title": "Chappi Hovězí a drůbeží maso kompletní krmivo pro dospělé psy 500g",
          "description": "čočka je fakt velká sračka",
          "price": 33.085,
          "image": "/content/product/97.jpg",
          "cat": 27,
          "url": "/produkt/97?url=Chappi+Hov%C4%9Bz%C3%AD+a+dr%C5%AFbe%C5%BE%C3%AD+maso+kompletn%C3%AD+krmivo+pro+dosp%C4%9Bl%C3%A9+psy+500g"
        }
      },
      {
        "_index": "product",
        "_type": "100",
        "_id": "100",
        "_score": 1,
        "_source": {
          "id": 100,
          "title": "Darling masová směs 10kg",
          "description": "čočka je fakt velká sračka",
          "price": 371.098,
          "image": "/content/product/100.jpg",
          "cat": 27,
          "url": "/produkt/100?url=Darling+masov%C3%A1+sm%C4%9Bs+10kg"
        }
      },
      {
        "_index": "product",
        "_type": "105",
        "_id": "105",
        "_score": 1,
        "_source": {
          "id": 105,
          "title": "Pedigree Vital Protection Junior Kuřecí maso kompletní krmivo pro štěňata 500g",
          "description": "čočka je fakt velká sračka",
          "price": 38.571,
          "image": "/content/product/105.jpg",
          "cat": 27,
          "url": "/produkt/105?url=Pedigree+Vital+Protection+Junior+Ku%C5%99ec%C3%AD+maso+kompletn%C3%AD+krmivo+pro+%C5%A1t%C4%9B%C5%88ata+500g"
        }
      },
      {
        "_index": "product",
        "_type": "112",
        "_id": "112",
        "_score": 1,
        "_source": {
          "id": 112,
          "title": "Friskies Balance 500g",
          "description": "čočka je fakt velká sračka",
          "price": 35.997,
          "image": "/content/product/112.jpg",
          "cat": 27,
          "url": "/produkt/112?url=Friskies+Balance+500g"
        }
      },
      {
        "_index": "product",
        "_type": "117",
        "_id": "117",
        "_score": 1,
        "_source": {
          "id": 117,
          "title": "Frolic Závitky s příchutí hovězího masa a sýra doplňkové krmivo pro dospělé psy 7 ks 140g",
          "description": "čočka je fakt velká sračka",
          "price": 29.081,
          "image": "/content/product/117.jpg",
          "cat": 27,
          "url": "/produkt/117?url=Frolic+Z%C3%A1vitky+s+p%C5%99%C3%ADchut%C3%AD+hov%C4%9Bz%C3%ADho+masa+a+s%C3%BDra+dopl%C5%88kov%C3%A9+krmivo+pro+dosp%C4%9Bl%C3%A9+psy+7+ks+140g"
        }
      }
    ]
  }
}

Has anyone had the same problem or know how to fix it?

Thanks for answer

Tried it with fresh ES 1.4

curl -X POST localhost:9200/product

curl -X POST localhost:9200/product/_mapping/product -d '{"product":{"properties":{"cat":{"type":"integer","index":"not_analyzed"}}}}'

curl -X POST 'localhost:9200/product/product' -d '{"cat":27}'

curl localhost:9200/product/_search -d '{"query":{"filtered":{"filter":{"term":{"cat":27}}}}}'

Response:

{"took":64,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":1.0,"hits":[{"_index":"product","_type":"product","_id":"AU3ipiqXLZr6Y64GIJXS","_score":1.0,"_source":{"cat":27}}]}}

How do you issue the query into ES?

Regards,
Lukas

Hi Lukáš,

for indexing and mapping Iam using [PHP library][1] [1]: https://github.com/ruflin/Elastica. For searching I am using javasript library from elastic.

The main problem for query http://localhost:9200/product/_search?q=cat:. i don't get any result, but i don't know why for other field is everything ok.

Elastic version: 1.5.2

Thanks,
David