Querying based on some dynamic name and quantity, rather than string popularity

I have a list of specifications per item in my database. I'd like to index
these specifications and then query them.

The problem is the specifications vary per item type (and even within items
of the same type), and querying specifications is useful only through
numerical quantities rather than a tokenized popular word search.

For example, take two items:

Item 1: {

"name": "Cool Shirt",
 "item_type": "Clothing",
 "specifications": {
     "nylon": "50 %",
     "elasticity": "max 2 %",
     "cotton": "40 %",
  }

}

Item 2: {

  "name": "Nail",
  "item_type": "Hardware",
  "specifications": {
       "length": "4 mm",
       "head_diameter: "2mm",
       "steel": "20 %",
  }

}

Item 2: {

  "name": "Nail",
  "item_type": "Hardware",
  "specifications": {
       "length": "17 mm",
       "head_diameter: "3mm",
       "iron": "10 %",
       "annular_rings": True
  }

}

The specifications can vary even within the same item type.

I would like to build queries that ask things like:

- Give me all shirts that have a max elasticity of 2%

- Give me all shirts that have at least 40% cotton and nylon that is 

between 50%-60%

- Give me all nails that have lengths of at least 2 mm and are also at 

least 10% steel

And so on...

It is not necessary make ES guess at the specification name. The user will
input that. So if a user wants to search for clothes with 'nylon', it would
be something like:

nylon="30%"

And then ES would look for a specification name called 'nylon'. Something
along those lines.

I looked at aggregations:
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-bucket-significantterms-aggregation.html

But I'm not quite sure how this would apply. It seems aggregations are for
document fields that are static and not semi-dynamic like in my case.

Are there any suggestions? I was planning on storing all items in one
document called 'items', but the specifications part is difficult to figure
out.

--
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/f516c4ad-4b44-4564-b0c2-36d987e01647%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

I had a typo:

I meant to say 3 items, and the third item should should say 'Item 3' not
'Item 2'

On Monday, December 15, 2014 10:08:16 PM UTC-5, am wrote:

I have a list of specifications per item in my database. I'd like to index
these specifications and then query them.

The problem is the specifications vary per item type (and even within
items of the same type), and querying specifications is useful only through
numerical quantities rather than a tokenized popular word search.

For example, take two items:

Item 1: {

"name": "Cool Shirt",
 "item_type": "Clothing",
 "specifications": {
     "nylon": "50 %",
     "elasticity": "max 2 %",
     "cotton": "40 %",
  }

}

Item 2: {

  "name": "Nail",
  "item_type": "Hardware",
  "specifications": {
       "length": "4 mm",
       "head_diameter: "2mm",
       "steel": "20 %",
  }

}

Item 2: {

  "name": "Nail",
  "item_type": "Hardware",
  "specifications": {
       "length": "17 mm",
       "head_diameter: "3mm",
       "iron": "10 %",
       "annular_rings": True
  }

}

The specifications can vary even within the same item type.

I would like to build queries that ask things like:

- Give me all shirts that have a max elasticity of 2%

- Give me all shirts that have at least 40% cotton and nylon that is 

between 50%-60%

- Give me all nails that have lengths of at least 2 mm and are also at 

least 10% steel

And so on...

It is not necessary make ES guess at the specification name. The user will
input that. So if a user wants to search for clothes with 'nylon', it would
be something like:

nylon="30%"

And then ES would look for a specification name called 'nylon'. Something
along those lines.

I looked at aggregations:

Elasticsearch Platform — Find real-time answers at scale | Elastic

But I'm not quite sure how this would apply. It seems aggregations are for
document fields that are static and not semi-dynamic like in my case.

Are there any suggestions? I was planning on storing all items in one
document called 'items', but the specifications part is difficult to figure
out.

--
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/ad0dcdfa-01fb-4f00-afb1-9eba1503cec0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.