Problems with combination of attributes in Elasticsearch

Hi all,

When designing an application I would like to know whether ElasticSearch is
a suitable tool for implementing it (and how to do it). Any advice will be
much appreciated!

My application needs to store (many) documents, each document being
represented as a sequence of words. I want also to associate information
with each word. For example, suppose I want to associate the word length
with each word. So I would have something like this:

The house is yellow

3 5 2 6

Now, I would like to perform queries such as for instance "give me words
with length 2, followed by the word 'yellow'". In a relational database I
would store the word forms and lengths as different attributes, for
instance:

Word

Length

N

the

3

1

house

5

2

is

2

3

yellow

6

4

(where N is the position of the word) and in SQL I would make something
like this:

SELECT word, N1 as N

FROM documents

WHERE (word=”yellow” AND N1 in (SELECT N2 as N

FROM documents

WHERE length=2 AND (N1-N2=1 OR N2-N1=1)

)

)

I'm struggling to implement this same functionality into ElasticSearch.
I've read online manuals and the reference book, but I'm unable to figure
out how to do this with ES. So any advice from your part will be very much
appreciated.

Take into account:

The database will have many attributes associated with words, and I'll
need to query for any combination of them.

Those attributes are pre-computed and loaded into the database offline.

Thank you!

--
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/1697f5ad-e00b-4777-a7f9-8239e9c64e91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.