Is it possible to use variables in indexed documents in elasticsearch?


(radhe) #1

Is it possible to use variables in indexed documents in elasticsearch?

POST somki/_doc/
{
    "suggest": {
        "input": ["my name is x"]
        }
    }
}

I want to have x as variable so that when someone search something system should show value of x from another index based on user.


(Mark Walkom) #2

No, you cannot do that.


(radhe) #3

Is it possible to show suggestion as "Something is x and y" where x and y will be different for each user and will have multiple values and those which have highest weight will be shown?


(Mark Walkom) #4

I guess that depends how you are defining and weighing them.


(radhe) #5

Can you provide an example? I'm new to elasticsearch and did not find much on web about what I'm looking for. Thanks!


(Mark Walkom) #6

You need a way to define what these variables are per user and then define weights to them, how you do that isn't really an Elasticsearch thing it's how you structure your document.


(radhe) #7

Is it possible to show prefix in suggester from different index?
What I mean is, In documents if I store some strings in prefix field then they are being shown in suggestions but if I want to show prefix from other index, can it be done and how?


(Mark Walkom) #8

You'd have to write something entirely custom in your code for that I'd imagine.


(radhe) #9

Thanks


(system) #10

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.